@microsoft/agents-hosting 1.5.0-beta.10.gc9dfbe84d2 → 1.5.0-beta.12.ga9a2b23c19

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 (51) hide show
  1. package/dist/package.json +2 -2
  2. package/dist/src/app/agentApplication.d.ts +14 -0
  3. package/dist/src/app/agentApplication.js +31 -2
  4. package/dist/src/app/agentApplication.js.map +1 -1
  5. package/dist/src/app/agentApplicationBuilder.d.ts +7 -0
  6. package/dist/src/app/agentApplicationBuilder.js +9 -0
  7. package/dist/src/app/agentApplicationBuilder.js.map +1 -1
  8. package/dist/src/app/agentApplicationOptions.d.ts +6 -0
  9. package/dist/src/app/index.d.ts +1 -0
  10. package/dist/src/app/index.js +1 -0
  11. package/dist/src/app/index.js.map +1 -1
  12. package/dist/src/app/proactive/conversation.d.ts +43 -0
  13. package/dist/src/app/proactive/conversation.js +67 -0
  14. package/dist/src/app/proactive/conversation.js.map +1 -0
  15. package/dist/src/app/proactive/conversationBuilder.d.ts +54 -0
  16. package/dist/src/app/proactive/conversationBuilder.js +110 -0
  17. package/dist/src/app/proactive/conversationBuilder.js.map +1 -0
  18. package/dist/src/app/proactive/conversationReferenceBuilder.d.ts +68 -0
  19. package/dist/src/app/proactive/conversationReferenceBuilder.js +125 -0
  20. package/dist/src/app/proactive/conversationReferenceBuilder.js.map +1 -0
  21. package/dist/src/app/proactive/createConversationOptions.d.ts +30 -0
  22. package/dist/src/app/proactive/createConversationOptions.js +10 -0
  23. package/dist/src/app/proactive/createConversationOptions.js.map +1 -0
  24. package/dist/src/app/proactive/createConversationOptionsBuilder.d.ts +69 -0
  25. package/dist/src/app/proactive/createConversationOptionsBuilder.js +141 -0
  26. package/dist/src/app/proactive/createConversationOptionsBuilder.js.map +1 -0
  27. package/dist/src/app/proactive/index.d.ts +7 -0
  28. package/dist/src/app/proactive/index.js +26 -0
  29. package/dist/src/app/proactive/index.js.map +1 -0
  30. package/dist/src/app/proactive/proactive.d.ts +248 -0
  31. package/dist/src/app/proactive/proactive.js +271 -0
  32. package/dist/src/app/proactive/proactive.js.map +1 -0
  33. package/dist/src/app/proactive/proactiveOptions.d.ts +19 -0
  34. package/dist/src/app/proactive/proactiveOptions.js +5 -0
  35. package/dist/src/app/proactive/proactiveOptions.js.map +1 -0
  36. package/dist/src/errorHelper.js +94 -0
  37. package/dist/src/errorHelper.js.map +1 -1
  38. package/package.json +2 -2
  39. package/src/app/agentApplication.ts +33 -0
  40. package/src/app/agentApplicationBuilder.ts +11 -0
  41. package/src/app/agentApplicationOptions.ts +7 -0
  42. package/src/app/index.ts +1 -0
  43. package/src/app/proactive/conversation.ts +87 -0
  44. package/src/app/proactive/conversationBuilder.ts +139 -0
  45. package/src/app/proactive/conversationReferenceBuilder.ts +161 -0
  46. package/src/app/proactive/createConversationOptions.ts +35 -0
  47. package/src/app/proactive/createConversationOptionsBuilder.ts +181 -0
  48. package/src/app/proactive/index.ts +10 -0
  49. package/src/app/proactive/proactive.ts +481 -0
  50. package/src/app/proactive/proactiveOptions.ts +24 -0
  51. package/src/errorHelper.ts +108 -0
@@ -1 +1 @@
1
- {"version":3,"file":"errorHelper.js","sourceRoot":"","sources":["../../src/errorHelper.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;AAIrB,QAAA,MAAM,GAA4C;IAC7D,+EAA+E;IAC/E,uDAAuD;IACvD,+EAA+E;IAE/E;;SAEK;IACL,kBAAkB,EAAE;QAClB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,+BAA+B;KAC7C;IAED;;SAEK;IACL,0BAA0B,EAAE;QAC1B,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,0CAA0C;KACxD;IAED;;SAEK;IACL,mBAAmB,EAAE;QACnB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,8BAA8B;KAC5C;IAED;;SAEK;IACL,qBAAqB,EAAE;QACrB,IAAI,EAAE,CAAC,MA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AAA"}
1
+ {"version":3,"file":"errorHelper.js","sourceRoot":"","sources":["../../src/errorHelper.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;AAIrB,QAAA,MAAM,GAA4C;IAC7D,+EAA+E;IAC/E,uDAAuD;IACvD,+EAA+E;IAE/E;;SAEK;IACL,kBAAkB,EAAE;QAClB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,+BAA+B;KAC7C;IAED;;SAEK;IACL,0BAA0B,EAAE;QAC1B,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,0CAA0C;KACxD;IAED;;SAEK;IACL,mBAAmB,EAAE;QACnB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,8BAA8B;KAC5C;IAED;;SAEK;IACL,qBAAqB,EAAE;QACrB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,yBAAyB;KACvC;IAED;;SAEK;IACL,gBAAgB,EAAE;QAChB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,uBAAuB;KACrC;IAED;;SAEK;IACL,yBAAyB,EAAE;QACzB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,6BAA6B;KAC3C;IAED;;SAEK;IACL,oBAAoB,EAAE;QACpB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,4DAA4D;KAC1E;IAED;;SAEK;IACL,2BAA2B,EAAE;QAC3B,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,+BAA+B;KAC7C;IAED;;SAEK;IACL,yBAAyB,EAAE;QACzB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,4DAA4D;KAC1E;IAED;;SAEK;IACL,wBAAwB,EAAE;QACxB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,4BAA4B;KAC1C;IAED,+EAA+E;IAC/E,uDAAuD;IACvD,+EAA+E;IAE/E;;SAEK;IACL,iBAAiB,EAAE;QACjB,IAAI,EAAE,CAAC,MAAM;Q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,MAAM;QACb,WAAW,EAAE,iEAAiE;KAC/E;IAED;;OAEG;IACH,6BAA6B,EAAE;QAC7B,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,4DAA4D;KAC1E;IAED;;OAEG;IACH,sBAAsB,EAAE;QACtB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,oEAAoE;KAClF;IAED;;OAEG;IACH,wCAAwC,EAAE;QACxC,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,4FAA4F;KAC1G;IAED;;OAEG;IACH,2BAA2B,EAAE;QAC3B,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,oHAAoH;KAClI;IAED,+EAA+E;IAC/E,2BAA2B;IAC3B,+EAA+E;IAE/E;;SAEK;IACL,gBAAgB,EAAE;QAChB,IAAI,EAAE,CAAC,MAAM;QACb,WAAW,EAAE,oCAAoC;KAClD;CACF,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@microsoft/agents-hosting",
4
- "version": "1.5.0-beta.10.gc9dfbe84d2",
4
+ "version": "1.5.0-beta.12.ga9a2b23c19",
5
5
  "homepage": "https://github.com/microsoft/Agents-for-js",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@azure/core-auth": "^1.10.1",
23
23
  "@azure/msal-node": "^5.0.6",
24
- "@microsoft/agents-activity": "1.5.0-beta.10.gc9dfbe84d2",
24
+ "@microsoft/agents-activity": "1.5.0-beta.12.ga9a2b23c19",
25
25
  "axios": "^1.13.6",
26
26
  "jsonwebtoken": "^9.0.3",
27
27
  "jwks-rsa": "^4.0.1",
@@ -20,7 +20,10 @@ import { RouteList } from './routeList'
20
20
  import { TranscriptLoggerMiddleware } from '../transcript'
21
21
  import { CloudAdapter } from '../cloudAdapter'
22
22
  import { Authorization, UserAuthorization, AuthorizationManager } from './auth'
23
+ import { Proactive } from './proactive'
23
24
  import { JwtPayload } from 'jsonwebtoken'
25
+ import { ExceptionHelper } from '@microsoft/agents-activity'
26
+ import { Errors } from '../errorHelper'
24
27
 
25
28
  const logger = debug('agents:app')
26
29
 
@@ -76,6 +79,7 @@ export class AgentApplication<TState extends TurnState> {
76
79
  private readonly _adapter?: CloudAdapter
77
80
  private readonly _authorizationManager?: AuthorizationManager
78
81
  private readonly _authorization?: Authorization
82
+ private readonly _proactive?: Proactive<TState>
79
83
  private _typingTimer: NodeJS.Timeout | undefined
80
84
  protected readonly _extensions: AgentExtension<TState>[] = []
81
85
  private readonly _adaptiveCards: AdaptiveCardsActions<TState>
@@ -130,6 +134,14 @@ export class AgentApplication<TState extends TurnState> {
130
134
  this._authorization = new UserAuthorization(this._authorizationManager)
131
135
  }
132
136
 
137
+ // Create Proactive whenever proactive options are explicitly configured or a storage
138
+ // backend is available — no explicit `proactive` option is required.
139
+ if (this._options.proactive !== undefined || this._options.storage !== undefined) {
140
+ const proactiveOpts = this._options.proactive ?? {}
141
+ const proactiveStorage = proactiveOpts.storage ?? this._options.storage
142
+ this._proactive = new Proactive<TState>(this, { ...proactiveOpts, storage: proactiveStorage })
143
+ }
144
+
133
145
  if (this._options.longRunningMessages && !this._adapter && !this._options.agentAppId) {
134
146
  throw new Error('The Application.longRunningMessages property is unavailable because no adapter was configured in the app.')
135
147
  }
@@ -157,6 +169,27 @@ export class AgentApplication<TState extends TurnState> {
157
169
  return this._authorization
158
170
  }
159
171
 
172
+ /**
173
+ * Gets the proactive messaging subsystem.
174
+ *
175
+ * @throws Error if no storage backend was configured (neither `options.storage` nor
176
+ * `options.proactive.storage`).
177
+ */
178
+ public get proactive (): Proactive<TState> {
179
+ if (!this._proactive) {
180
+ throw ExceptionHelper.generateException(Error, Errors.ProactivePropertyUnavailable)
181
+ }
182
+ return this._proactive
183
+ }
184
+
185
+ /**
186
+ * Returns `true` if user authorization was configured, without throwing.
187
+ * Used internally by the Proactive subsystem to check whether token acquisition is available.
188
+ */
189
+ public get hasUserAuthorization (): boolean {
190
+ return this._authorization !== undefined
191
+ }
192
+
160
193
  /**
161
194
  * Gets the options used to configure the application.
162
195
  *
@@ -7,6 +7,7 @@ import { Storage } from '../storage'
7
7
  import { AgentApplication } from './agentApplication'
8
8
  import { AgentApplicationOptions } from './agentApplicationOptions'
9
9
  import { AuthorizationOptions } from './auth/types'
10
+ import { ProactiveOptions } from './proactive'
10
11
  import { TurnState } from './turnState'
11
12
 
12
13
  /**
@@ -64,6 +65,16 @@ export class AgentApplicationBuilder<TState extends TurnState = TurnState> {
64
65
  return this
65
66
  }
66
67
 
68
+ /**
69
+ * Configures the proactive messaging subsystem.
70
+ * @param options Proactive options including optional storage backend
71
+ * @returns This builder instance for chaining
72
+ */
73
+ public withProactive (options: ProactiveOptions): this {
74
+ this._options.proactive = options
75
+ return this
76
+ }
77
+
67
78
  /**
68
79
  * Builds and returns a new AgentApplication instance configured with the provided options.
69
80
  * @returns A new AgentApplication instance
@@ -12,6 +12,7 @@ import { TurnState } from './turnState'
12
12
  import { HeaderPropagationDefinition } from '../headerPropagation'
13
13
  import { AuthorizationOptions } from './auth/types'
14
14
  import { Connections } from '../auth/connections'
15
+ import { ProactiveOptions } from './proactive'
15
16
 
16
17
  /**
17
18
  * Configuration options for creating and initializing an Agent Application.
@@ -147,4 +148,10 @@ export interface AgentApplicationOptions<TState extends TurnState> {
147
148
  * identity providers.
148
149
  */
149
150
  connections?: Connections
151
+
152
+ /**
153
+ * Optional. Configuration for the proactive messaging subsystem.
154
+ * When provided, `app.proactive` will be available.
155
+ */
156
+ proactive?: ProactiveOptions
150
157
  }
package/src/app/index.ts CHANGED
@@ -19,3 +19,4 @@ export * from './adaptiveCards'
19
19
  export * from './streaming/streamingResponse'
20
20
  export * from './streaming/citation'
21
21
  export * from './teamsAttachmentDownloader'
22
+ export * from './proactive'
@@ -0,0 +1,87 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ import type { JwtPayload } from 'jsonwebtoken'
5
+ import type { ConversationReference } from '@microsoft/agents-activity'
6
+ import { ExceptionHelper } from '@microsoft/agents-activity'
7
+ import type { TurnContext } from '../../turnContext'
8
+ import { Errors } from '../../errorHelper'
9
+
10
+ /**
11
+ * JWT-like claims identifying the agent for proactive authentication.
12
+ * `aud` (the agent's client ID) is required; all other fields are optional.
13
+ */
14
+ export interface ConversationClaims {
15
+ aud: string
16
+ azp?: string
17
+ appid?: string
18
+ tid?: string
19
+ [key: string]: string | undefined
20
+ }
21
+
22
+ /**
23
+ * A serializable pair of a `ConversationReference` and the JWT claims needed
24
+ * to authenticate proactive calls on behalf of this agent.
25
+ *
26
+ * Instances are stored in and retrieved from the proactive storage backend.
27
+ * The `identity` getter produces the `JwtPayload` shape expected by
28
+ * `adapter.continueConversation()`.
29
+ */
30
+ export class Conversation {
31
+ reference: ConversationReference
32
+ claims: ConversationClaims
33
+
34
+ constructor (context: TurnContext)
35
+ constructor (claims: ConversationClaims, reference: ConversationReference)
36
+ constructor (
37
+ contextOrClaims: TurnContext | ConversationClaims,
38
+ reference?: ConversationReference
39
+ ) {
40
+ if ('activity' in contextOrClaims) {
41
+ // TurnContext overload
42
+ const context = contextOrClaims as TurnContext
43
+ this.reference = context.activity.getConversationReference()
44
+ const id = context.identity as JwtPayload | undefined
45
+ this.claims = {
46
+ ...(id ?? {}),
47
+ aud: Array.isArray(id?.aud) ? (id.aud as string[])[0] : (id?.aud ?? '')
48
+ } as ConversationClaims
49
+ } else {
50
+ // (claims, reference) overload — matches C# parameter order
51
+ this.claims = contextOrClaims as ConversationClaims
52
+ this.reference = reference!
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Returns a `JwtPayload`-compatible object for passing to
58
+ * `adapter.continueConversation()` as `botAppIdOrIdentity`.
59
+ */
60
+ get identity (): JwtPayload {
61
+ return this.claims as unknown as JwtPayload
62
+ }
63
+
64
+ /**
65
+ * Returns a JSON string of `{ reference, claims }` — suitable for use in
66
+ * HTTP request bodies when passing a conversation to another service.
67
+ */
68
+ toJson (): string {
69
+ return JSON.stringify({ reference: this.reference, claims: this.claims })
70
+ }
71
+
72
+ /**
73
+ * Throws if any required field is missing.
74
+ * Called by `Proactive.storeConversation()` before writing to storage.
75
+ */
76
+ validate (): void {
77
+ if (!this.reference.conversation?.id) {
78
+ throw ExceptionHelper.generateException(Error, Errors.ConversationInvalidId)
79
+ }
80
+ if (!this.reference.serviceUrl) {
81
+ throw ExceptionHelper.generateException(Error, Errors.ConversationInvalidServiceUrl)
82
+ }
83
+ if (!this.claims.aud) {
84
+ throw ExceptionHelper.generateException(Error, Errors.ConversationInvalidAud)
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,139 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ import type { ChannelAccount, ConversationAccount, ConversationReference } from '@microsoft/agents-activity'
5
+ import type { TurnContext } from '../../turnContext'
6
+ import { Conversation, type ConversationClaims } from './conversation'
7
+ import { ConversationReferenceBuilder } from './conversationReferenceBuilder'
8
+
9
+ /**
10
+ * Fluent builder for the `Conversation` class.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Build from scratch
15
+ * const conv = ConversationBuilder
16
+ * .create('my-client-id', 'msteams')
17
+ * .withUser('user-aad-id')
18
+ * .withConversationId('19:channel@thread.skype')
19
+ * .build()
20
+ *
21
+ * // Build from a live TurnContext
22
+ * const conv = ConversationBuilder.fromContext(turnContext).build()
23
+ * ```
24
+ */
25
+ export class ConversationBuilder {
26
+ private readonly _agentClientId: string
27
+ private readonly _channelId: string
28
+ private readonly _serviceUrl: string
29
+ private _claims: ConversationClaims
30
+ private _reference: Partial<ConversationReference>
31
+
32
+ private constructor (
33
+ agentClientId: string,
34
+ channelId: string,
35
+ serviceUrl: string,
36
+ claims: ConversationClaims,
37
+ reference: Partial<ConversationReference>
38
+ ) {
39
+ this._agentClientId = agentClientId
40
+ this._channelId = channelId
41
+ this._serviceUrl = serviceUrl
42
+ this._claims = claims
43
+ this._reference = reference
44
+ }
45
+
46
+ /**
47
+ * Creates a new builder for the given agent and channel.
48
+ * @param requestorId Optional: the client ID of the app making the request.
49
+ * Becomes the `appid` claim, used in multi-tenant Azure Bot scenarios.
50
+ */
51
+ static create (
52
+ agentClientId: string,
53
+ channelId: string,
54
+ serviceUrl?: string,
55
+ requestorId?: string
56
+ ): ConversationBuilder {
57
+ const claims: ConversationClaims = { aud: agentClientId }
58
+ if (requestorId) claims.appid = requestorId
59
+ return new ConversationBuilder(agentClientId, channelId, serviceUrl ?? '', claims, ConversationReferenceBuilder.create(agentClientId, channelId, serviceUrl).build())
60
+ }
61
+
62
+ /**
63
+ * Creates a builder pre-populated from a live `TurnContext`.
64
+ * Captures both the conversation reference and the JWT identity claims.
65
+ */
66
+ static fromContext (context: TurnContext): ConversationBuilder {
67
+ const ref = context.activity.getConversationReference()
68
+ const id = context.identity
69
+ const aud = Array.isArray(id?.aud) ? id.aud[0] : (id?.aud ?? '')
70
+ const claims: ConversationClaims = {
71
+ ...(id ?? {}),
72
+ aud,
73
+ } as ConversationClaims
74
+ return new ConversationBuilder(
75
+ aud,
76
+ ref.channelId,
77
+ ref.serviceUrl ?? '',
78
+ claims,
79
+ ref
80
+ )
81
+ }
82
+
83
+ /** Sets `reference.user`. */
84
+ withUser (userId: string, userName?: string): this {
85
+ const user: ChannelAccount = { id: userId, name: userName }
86
+ this._reference = { ...this._reference, user }
87
+ return this
88
+ }
89
+
90
+ /** Sets `reference.conversation.id`. */
91
+ withConversationId (id: string): this {
92
+ const conversation: ConversationAccount = { ...(this._reference.conversation ?? { isGroup: false }), id }
93
+ this._reference = { ...this._reference, conversation }
94
+ return this
95
+ }
96
+
97
+ /** Sets `reference.conversation` from a full `ConversationAccount`. */
98
+ withConversation (account: ConversationAccount): this {
99
+ this._reference = { ...this._reference, conversation: account }
100
+ return this
101
+ }
102
+
103
+ /** Sets `reference.activityId`. */
104
+ withActivityId (activityId: string): this {
105
+ this._reference = { ...this._reference, activityId }
106
+ return this
107
+ }
108
+
109
+ /**
110
+ * Merges a partial `ConversationReference` into the current one.
111
+ * Useful for overlaying externally-provided reference data without losing
112
+ * fields set by earlier builder calls.
113
+ */
114
+ withReference (ref: Partial<ConversationReference>): this {
115
+ this._reference = { ...this._reference, ...ref }
116
+ return this
117
+ }
118
+
119
+ /** Builds the `Conversation`, auto-filling `serviceUrl` from channel defaults if needed. */
120
+ build (): Conversation {
121
+ const serviceUrl =
122
+ this._serviceUrl ||
123
+ this._reference.serviceUrl ||
124
+ ConversationReferenceBuilder.serviceUrlForChannel(this._channelId)
125
+
126
+ const reference: ConversationReference = {
127
+ conversation: this._reference.conversation ?? { id: '', isGroup: false },
128
+ agent: this._reference.agent ?? { id: this._agentClientId },
129
+ ...this._reference,
130
+ // Ensure channelId and serviceUrl always use our resolved values
131
+ channelId: this._channelId,
132
+ serviceUrl,
133
+ }
134
+
135
+ const conv = new Conversation(this._claims, reference)
136
+ conv.validate()
137
+ return conv
138
+ }
139
+ }
@@ -0,0 +1,161 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ import type { ChannelAccount, ConversationReference } from '@microsoft/agents-activity'
5
+ import { Channels, RoleTypes } from '@microsoft/agents-activity'
6
+ import { debug } from '@microsoft/agents-activity/logger'
7
+
8
+ const logger = debug('agents:conversation-reference-builder')
9
+
10
+ /** Set of all channel IDs defined in the Channels enum, used for validation. */
11
+ const knownChannelIds = new Set(Object.values(Channels) as string[])
12
+
13
+ /**
14
+ * Well-known Teams service URLs for proactive messaging.
15
+ *
16
+ * Use only when the incoming `serviceUrl` from a real conversation is unavailable.
17
+ * Once you have received a `serviceUrl` from a real turn, cache and prefer that value.
18
+ */
19
+ export const TeamsServiceEndpoints = {
20
+ /** Standard public cloud Teams endpoint. */
21
+ publicGlobal: 'https://smba.trafficmanager.net/teams/',
22
+ /** US Government Community Cloud (GCC). */
23
+ gcc: 'https://smba.infra.gcc.teams.microsoft.com/teams',
24
+ /** US Government Community Cloud High (GCC-High). */
25
+ gccHigh: 'https://smba.infra.gov.teams.microsoft.us/teams',
26
+ /** US Department of Defense (DoD). */
27
+ dod: 'https://smba.infra.dod.teams.microsoft.us/teams',
28
+ } as const
29
+
30
+ /**
31
+ * Fluent builder for `ConversationReference`.
32
+ */
33
+ export class ConversationReferenceBuilder {
34
+ private readonly _channelId: string
35
+ private _serviceUrl: string
36
+ private _agent: ChannelAccount
37
+ private _user?: ChannelAccount
38
+ private _conversationId?: string
39
+ private _activityId?: string
40
+ private _locale?: string
41
+
42
+ private constructor (channelId: string, serviceUrl: string, agent: ChannelAccount) {
43
+ this._channelId = channelId
44
+ this._serviceUrl = serviceUrl
45
+ this._agent = agent
46
+ }
47
+
48
+ /**
49
+ * Creates a new builder seeded with the agent identity and channel.
50
+ * On Teams, the agent id is prefixed with `28:` automatically.
51
+ * @param agentClientId The agent's client (app) ID.
52
+ * @param channelId The target channel (e.g. `'msteams'`, `'webchat'`).
53
+ * @param serviceUrl Optional override. If omitted, `build()` fills in the
54
+ * channel default via `serviceUrlForChannel()`.
55
+ */
56
+ static create (
57
+ agentClientId: string,
58
+ channelId: string,
59
+ serviceUrl?: string
60
+ ): ConversationReferenceBuilder {
61
+ return new ConversationReferenceBuilder(
62
+ channelId,
63
+ serviceUrl ?? '',
64
+ ConversationReferenceBuilder.agentForChannel(channelId, agentClientId)
65
+ )
66
+ }
67
+
68
+ /**
69
+ * Returns the default service URL for a channel.
70
+ * Teams returns the public global endpoint; all other channels use the
71
+ * `https://{channelId}.botframework.com/` pattern (matching C# behavior).
72
+ */
73
+ static serviceUrlForChannel (channelId: string): string {
74
+ if (!channelId) return ''
75
+ if (channelId === Channels.Msteams) return TeamsServiceEndpoints.publicGlobal
76
+ if (!knownChannelIds.has(channelId)) {
77
+ logger.warn(
78
+ `serviceUrlForChannel: unrecognized channelId '${channelId}' — constructing fallback URL ` +
79
+ 'https://<channelId>.botframework.com/. Provide an explicit serviceUrl to suppress this warning.'
80
+ )
81
+ }
82
+ return `https://${channelId}.botframework.com/`
83
+ }
84
+
85
+ /** Sets `reference.user` from an id + optional name. Role defaults to `RoleTypes.User`. */
86
+ withUser (userId: string, userName?: string): this
87
+ /** Sets `reference.user` from a full `ChannelAccount`. */
88
+ withUser (account: ChannelAccount): this
89
+ withUser (userIdOrAccount: string | ChannelAccount, userName?: string): this {
90
+ this._user = typeof userIdOrAccount === 'string'
91
+ ? { id: userIdOrAccount, name: userName, role: RoleTypes.User }
92
+ : userIdOrAccount
93
+ return this
94
+ }
95
+
96
+ /** Sets `reference.agent` from an id + optional name. Role defaults to `RoleTypes.Agent`. On Teams, id is prefixed with `28:`. */
97
+ withAgent (agentClientId: string, agentName?: string): this
98
+ /** Sets `reference.agent` from a full `ChannelAccount`. */
99
+ withAgent (account: ChannelAccount): this
100
+ withAgent (agentIdOrAccount: string | ChannelAccount, agentName?: string): this {
101
+ this._agent = typeof agentIdOrAccount === 'string'
102
+ ? ConversationReferenceBuilder.agentForChannel(this._channelId, agentIdOrAccount, agentName)
103
+ : agentIdOrAccount
104
+ return this
105
+ }
106
+
107
+ /** Sets `reference.serviceUrl`. */
108
+ withServiceUrl (serviceUrl: string): this {
109
+ this._serviceUrl = serviceUrl
110
+ return this
111
+ }
112
+
113
+ /** Sets `reference.conversation.id`. */
114
+ withConversationId (id: string): this {
115
+ this._conversationId = id
116
+ return this
117
+ }
118
+
119
+ /** Sets `reference.activityId`. */
120
+ withActivityId (activityId: string): this {
121
+ this._activityId = activityId
122
+ return this
123
+ }
124
+
125
+ /** Sets `reference.locale`. */
126
+ withLocale (locale: string): this {
127
+ this._locale = locale
128
+ return this
129
+ }
130
+
131
+ /** Builds and returns the `ConversationReference`. */
132
+ build (): ConversationReference {
133
+ const serviceUrl =
134
+ this._serviceUrl || ConversationReferenceBuilder.serviceUrlForChannel(this._channelId)
135
+
136
+ const ref: ConversationReference = {
137
+ channelId: this._channelId,
138
+ serviceUrl,
139
+ conversation: { id: this._conversationId ?? '', isGroup: false },
140
+ agent: this._agent,
141
+ user: this._user ?? { role: RoleTypes.User },
142
+ }
143
+
144
+ if (this._activityId !== undefined) ref.activityId = this._activityId
145
+ if (this._locale !== undefined) ref.locale = this._locale
146
+
147
+ return ref
148
+ }
149
+
150
+ /**
151
+ * Builds a `ChannelAccount` for the agent, applying the Teams `28:` id prefix
152
+ * when the channel is `msteams`.
153
+ */
154
+ private static agentForChannel (channelId: string, agentClientId: string, agentName?: string): ChannelAccount {
155
+ return {
156
+ id: channelId === Channels.Msteams ? `28:${agentClientId}` : agentClientId,
157
+ name: agentName,
158
+ role: RoleTypes.Agent,
159
+ }
160
+ }
161
+ }
@@ -0,0 +1,35 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ import type { ConversationParameters } from '@microsoft/agents-activity'
5
+ import type { ConversationClaims } from './conversation'
6
+
7
+ /**
8
+ * Default OAuth scope for Azure Bot Service authentication.
9
+ */
10
+ export const AzureBotScope = 'https://api.botframework.com'
11
+
12
+ /**
13
+ * Options passed to `Proactive.createConversation()`.
14
+ * Flattened — no nested Conversation wrapper.
15
+ */
16
+ export interface CreateConversationOptions {
17
+ /** JWT claims for the agent identity. `aud` must be the agent's client ID. */
18
+ identity: ConversationClaims
19
+ /** The target channel (e.g. `'msteams'`). */
20
+ channelId: string
21
+ /** The service URL for the channel. */
22
+ serviceUrl: string
23
+ /**
24
+ * OAuth scope for token acquisition.
25
+ * Defaults to `AzureBotScope` when not set by the builder.
26
+ */
27
+ scope: string
28
+ /**
29
+ * When `true`, the resulting `Conversation` is stored automatically after
30
+ * creation. Defaults to `false`.
31
+ */
32
+ storeConversation?: boolean
33
+ /** Conversation configuration passed to `adapter.createConversationAsync()`. */
34
+ parameters: Partial<ConversationParameters>
35
+ }