@microsoft/m365agentsplayground-cli 0.2.26 → 0.2.27

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 (56) hide show
  1. package/README.md +8 -21
  2. package/{build → dist}/conversationTypes.d.ts +5 -0
  3. package/{build → dist}/index.d.ts +1 -1
  4. package/dist/index.js +8 -0
  5. package/dist/index.js.LICENSE.txt +157 -0
  6. package/dist/responseCapture.d.ts +42 -0
  7. package/{build → dist}/serverManager.d.ts +1 -2
  8. package/dist/start-server.js +9 -0
  9. package/dist/start-server.js.LICENSE.txt +157 -0
  10. package/{build → dist}/testClient.d.ts +1 -1
  11. package/{build → dist}/types.d.ts +9 -0
  12. package/package.json +22 -12
  13. package/build/cardValidator.d.ts.map +0 -1
  14. package/build/cardValidator.js +0 -46
  15. package/build/conversationServer.d.ts.map +0 -1
  16. package/build/conversationServer.js +0 -136
  17. package/build/conversationTypes.d.ts.map +0 -1
  18. package/build/conversationTypes.js +0 -5
  19. package/build/index.d.ts.map +0 -1
  20. package/build/index.js +0 -25
  21. package/build/notificationSender.d.ts.map +0 -1
  22. package/build/notificationSender.js +0 -83
  23. package/build/responseCapture.d.ts +0 -29
  24. package/build/responseCapture.d.ts.map +0 -1
  25. package/build/responseCapture.js +0 -119
  26. package/build/runConversation.d.ts.map +0 -1
  27. package/build/runConversation.js +0 -351
  28. package/build/serverManager.d.ts.map +0 -1
  29. package/build/serverManager.js +0 -149
  30. package/build/start-server.d.ts.map +0 -1
  31. package/build/start-server.js +0 -23
  32. package/build/testClient.d.ts.map +0 -1
  33. package/build/testClient.js +0 -434
  34. package/build/types.d.ts.map +0 -1
  35. package/build/types.js +0 -7
  36. package/build/websocketClient.d.ts.map +0 -1
  37. package/build/websocketClient.js +0 -129
  38. package/src/cardValidator.ts +0 -56
  39. package/src/conversationServer.ts +0 -147
  40. package/src/conversationTypes.ts +0 -157
  41. package/src/index.ts +0 -37
  42. package/src/notificationSender.ts +0 -103
  43. package/src/responseCapture.ts +0 -145
  44. package/src/runConversation.ts +0 -382
  45. package/src/serverManager.ts +0 -172
  46. package/src/start-server.ts +0 -26
  47. package/src/testClient.ts +0 -512
  48. package/src/types.ts +0 -155
  49. package/src/websocketClient.ts +0 -153
  50. package/tsconfig.json +0 -14
  51. /package/{build → dist}/cardValidator.d.ts +0 -0
  52. /package/{build → dist}/conversationServer.d.ts +0 -0
  53. /package/{build → dist}/notificationSender.d.ts +0 -0
  54. /package/{build → dist}/runConversation.d.ts +0 -0
  55. /package/{build → dist}/start-server.d.ts +0 -0
  56. /package/{build → dist}/websocketClient.d.ts +0 -0
@@ -0,0 +1,157 @@
1
+ /*!
2
+ * Application Insights JavaScript SDK - Web Snippet, 1.0.1
3
+ * Copyright (c) Microsoft and contributors. All rights reserved.
4
+ */
5
+
6
+ /*!
7
+ * body-parser
8
+ * Copyright(c) 2014 Jonathan Ong
9
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
10
+ * MIT Licensed
11
+ */
12
+
13
+ /*!
14
+ * body-parser
15
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
16
+ * MIT Licensed
17
+ */
18
+
19
+ /*!
20
+ * bytes
21
+ * Copyright(c) 2012-2014 TJ Holowaychuk
22
+ * Copyright(c) 2015 Jed Watson
23
+ * MIT Licensed
24
+ */
25
+
26
+ /*!
27
+ * content-type
28
+ * Copyright(c) 2015 Douglas Christopher Wilson
29
+ * MIT Licensed
30
+ */
31
+
32
+ /*!
33
+ * depd
34
+ * Copyright(c) 2014-2018 Douglas Christopher Wilson
35
+ * MIT Licensed
36
+ */
37
+
38
+ /*!
39
+ * destroy
40
+ * Copyright(c) 2014 Jonathan Ong
41
+ * Copyright(c) 2015-2022 Douglas Christopher Wilson
42
+ * MIT Licensed
43
+ */
44
+
45
+ /*!
46
+ * ee-first
47
+ * Copyright(c) 2014 Jonathan Ong
48
+ * MIT Licensed
49
+ */
50
+
51
+ /*!
52
+ * http-errors
53
+ * Copyright(c) 2014 Jonathan Ong
54
+ * Copyright(c) 2016 Douglas Christopher Wilson
55
+ * MIT Licensed
56
+ */
57
+
58
+ /*!
59
+ * media-typer
60
+ * Copyright(c) 2014 Douglas Christopher Wilson
61
+ * MIT Licensed
62
+ */
63
+
64
+ /*!
65
+ * mime-db
66
+ * Copyright(c) 2014 Jonathan Ong
67
+ * Copyright(c) 2015-2022 Douglas Christopher Wilson
68
+ * MIT Licensed
69
+ */
70
+
71
+ /*!
72
+ * mime-types
73
+ * Copyright(c) 2014 Jonathan Ong
74
+ * Copyright(c) 2015 Douglas Christopher Wilson
75
+ * MIT Licensed
76
+ */
77
+
78
+ /*!
79
+ * on-finished
80
+ * Copyright(c) 2013 Jonathan Ong
81
+ * Copyright(c) 2014 Douglas Christopher Wilson
82
+ * MIT Licensed
83
+ */
84
+
85
+ /*!
86
+ * raw-body
87
+ * Copyright(c) 2013-2014 Jonathan Ong
88
+ * Copyright(c) 2014-2022 Douglas Christopher Wilson
89
+ * MIT Licensed
90
+ */
91
+
92
+ /*!
93
+ * statuses
94
+ * Copyright(c) 2014 Jonathan Ong
95
+ * Copyright(c) 2016 Douglas Christopher Wilson
96
+ * MIT Licensed
97
+ */
98
+
99
+ /*!
100
+ * toidentifier
101
+ * Copyright(c) 2016 Douglas Christopher Wilson
102
+ * MIT Licensed
103
+ */
104
+
105
+ /*!
106
+ * type-is
107
+ * Copyright(c) 2014 Jonathan Ong
108
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
109
+ * MIT Licensed
110
+ */
111
+
112
+ /*!
113
+ * unpipe
114
+ * Copyright(c) 2015 Douglas Christopher Wilson
115
+ * MIT Licensed
116
+ */
117
+
118
+ /*! @azure/msal-common v15.9.0 2025-07-23 */
119
+
120
+ /*! @azure/msal-node v3.6.4 2025-07-23 */
121
+
122
+ /*! Axios v1.12.2 Copyright (c) 2025 Matt Zabriskie and contributors */
123
+
124
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
125
+
126
+ /**
127
+ * @license
128
+ * Lodash <https://lodash.com/>
129
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
130
+ * Released under MIT license <https://lodash.com/license>
131
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
132
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
133
+ */
134
+
135
+ /**
136
+ * Fast UUID generator, RFC4122 version 4 compliant.
137
+ * @author Jeff Ward (jcward.com).
138
+ * @license MIT license
139
+ * @link http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
140
+ **/
141
+
142
+ /** @preserve
143
+ * Counter block mode compatible with Dr Brian Gladman fileenc.c
144
+ * derived from CryptoJS.mode.CTR
145
+ * Jan Hruby jhruby.web@gmail.com
146
+ */
147
+
148
+ /** @preserve
149
+ (c) 2012 by Cédric Mesnil. All rights reserved.
150
+
151
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
152
+
153
+ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
154
+ - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
155
+
156
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
157
+ */
@@ -1,5 +1,5 @@
1
1
  import { EventEmitter } from "events";
2
- import { Message } from "server";
2
+ import type { Message } from "server";
3
3
  import { BotResponse, TestClientConfig } from "./types";
4
4
  /**
5
5
  * Test client for sending messages to a bot and receiving responses.
@@ -3,6 +3,10 @@ import { Message } from "server";
3
3
  import type { Attachment } from "server";
4
4
  export { ActionType, LogActionType } from "schema";
5
5
  export type { IAction, ICreateMessageAction, IUpdateMessageAction, ITypingAction, IActionMessage, ILogAction, IAppendLogAction, LogItem, } from "schema";
6
+ export type { AccountRole } from "schema";
7
+ export type { CustomActivityTemplateType } from "schema";
8
+ export type { Attachment } from "server";
9
+ export type { Message } from "server";
6
10
  /**
7
11
  * Bot configuration matching the .m365agentsplayground.yml format
8
12
  */
@@ -68,6 +72,11 @@ export interface TestClientConfig {
68
72
  * - "default": Bot posts responses back to the connector URL.
69
73
  */
70
74
  deliveryMode?: "expectReplies" | "default";
75
+ /**
76
+ * Disable telemetry data collection.
77
+ * Default: false
78
+ */
79
+ disableTelemetry?: boolean;
71
80
  /**
72
81
  * Quiet-period fallback (ms) for streaming bot responses.
73
82
  *
package/package.json CHANGED
@@ -1,14 +1,20 @@
1
1
  {
2
2
  "name": "@microsoft/m365agentsplayground-cli",
3
- "version": "0.2.26",
4
- "main": "build/index.js",
5
- "types": "build/index.d.ts",
3
+ "version": "0.2.27",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
6
  "bin": {
7
- "playground-cli-server": "build/start-server.js"
7
+ "playground-cli-server": "dist/start-server.js"
8
8
  },
9
+ "files": [
10
+ "dist"
11
+ ],
9
12
  "scripts": {
10
- "build": "tsc -p ./",
11
- "server": "node build/start-server.js"
13
+ "build": "rimraf dist && tsc -p ./ && npm run package",
14
+ "package": "rimraf dist && node --max-old-space-size=4096 ../../node_modules/webpack/bin/webpack.js --mode production --config ./webpack.config.js && npm run copy-declarations && npm run add-shebangs",
15
+ "copy-declarations": "node scripts/copy-declarations.js",
16
+ "add-shebangs": "node scripts/add-shebangs.js",
17
+ "prepack": "npm run build"
12
18
  },
13
19
  "devDependencies": {
14
20
  "@types/chai": "^4.3.5",
@@ -17,18 +23,22 @@
17
23
  "@types/mocha": "^10.0.1",
18
24
  "@types/node": "^20.3.1",
19
25
  "@types/ws": "^8.5.10",
26
+ "adaptivecards": "^3.0.4",
20
27
  "chai": "^4.3.7",
28
+ "copyfiles": "^2.4.1",
21
29
  "mocha": "^10.2.0",
30
+ "rimraf": "^5.0.0",
31
+ "schema": "^0.2.27",
32
+ "server": "^0.2.27",
33
+ "terser-webpack-plugin": "^5.3.9",
34
+ "ts-loader": "^9.4.4",
22
35
  "ts-node": "^10.9.1",
23
- "typescript": "^5.4.5"
36
+ "typescript": "^5.4.5",
37
+ "webpack": "^5.88.1",
38
+ "webpack-cli": "^5.1.4"
24
39
  },
25
40
  "dependencies": {
26
41
  "express": "^5.2.0",
27
- "schema": "^0.2.26",
28
- "server": "^0.2.26",
29
42
  "ws": "^8.18.0"
30
- },
31
- "optionalDependencies": {
32
- "adaptivecards": "^3.0.4"
33
43
  }
34
44
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"cardValidator.d.ts","sourceRoot":"","sources":["../src/cardValidator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,mBAAmB;IAClC,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAElC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,mBAAmB,EAAE,CAgCvB"}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- /**
3
- * Adaptive Card schema validation using the official `adaptivecards` package.
4
- *
5
- * Validates that a card payload is a well-formed Adaptive Card that Teams can
6
- * parse. Does NOT check visual rendering — only structural/schema correctness.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.validateAdaptiveCard = validateAdaptiveCard;
10
- const adaptivecards_1 = require("adaptivecards");
11
- /**
12
- * Validate a raw Adaptive Card JSON payload.
13
- * Returns an empty array if the card is valid.
14
- */
15
- function validateAdaptiveCard(
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- payload) {
18
- const errors = [];
19
- // Basic type guard: must have type === "AdaptiveCard"
20
- if (payload.type !== "AdaptiveCard") {
21
- errors.push({
22
- message: `Expected type "AdaptiveCard", got "${String(payload.type ?? "(missing)")}"`,
23
- phase: "schema",
24
- });
25
- return errors; // No point parsing further
26
- }
27
- try {
28
- const card = new adaptivecards_1.AdaptiveCard();
29
- const context = new adaptivecards_1.SerializationContext();
30
- card.parse(payload, context);
31
- for (let i = 0; i < context.eventCount; i++) {
32
- const event = context.getEventAt(i);
33
- errors.push({
34
- message: event.message ?? String(event),
35
- phase: event.phase !== undefined ? String(event.phase) : "parsing",
36
- });
37
- }
38
- }
39
- catch (err) {
40
- errors.push({
41
- message: err instanceof Error ? err.message : String(err),
42
- phase: "parsing",
43
- });
44
- }
45
- return errors;
46
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"conversationServer.d.ts","sourceRoot":"","sources":["../src/conversationServer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,MAAM,WAAW,yBAAyB;IACxC,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AA4ED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,kBAAkB,CAAC,CAgC7B"}
@@ -1,136 +0,0 @@
1
- "use strict";
2
- /**
3
- * HTTP server for multi-turn conversation execution.
4
- *
5
- * Provides a factory function that creates an HTTP server with:
6
- * POST /run-conversation — execute a multi-turn conversation
7
- * GET /health — health check
8
- *
9
- * All diagnostic logging goes to stderr. The returned port can be
10
- * written to stdout by the caller (CLI wrapper).
11
- */
12
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- var desc = Object.getOwnPropertyDescriptor(m, k);
15
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
16
- desc = { enumerable: true, get: function() { return m[k]; } };
17
- }
18
- Object.defineProperty(o, k2, desc);
19
- }) : (function(o, m, k, k2) {
20
- if (k2 === undefined) k2 = k;
21
- o[k2] = m[k];
22
- }));
23
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
24
- Object.defineProperty(o, "default", { enumerable: true, value: v });
25
- }) : function(o, v) {
26
- o["default"] = v;
27
- });
28
- var __importStar = (this && this.__importStar) || (function () {
29
- var ownKeys = function(o) {
30
- ownKeys = Object.getOwnPropertyNames || function (o) {
31
- var ar = [];
32
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
- return ar;
34
- };
35
- return ownKeys(o);
36
- };
37
- return function (mod) {
38
- if (mod && mod.__esModule) return mod;
39
- var result = {};
40
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
- __setModuleDefault(result, mod);
42
- return result;
43
- };
44
- })();
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.createConversationServer = createConversationServer;
47
- const http = __importStar(require("http"));
48
- const runConversation_1 = require("./runConversation");
49
- // ─────────────────────────────────────────────────────────────────────────────
50
- // Request body parsing
51
- // ─────────────────────────────────────────────────────────────────────────────
52
- function readBody(req) {
53
- return new Promise((resolve, reject) => {
54
- const chunks = [];
55
- req.on("data", (chunk) => chunks.push(chunk));
56
- req.on("end", () => resolve(Buffer.concat(chunks).toString("utf-8")));
57
- req.on("error", reject);
58
- });
59
- }
60
- async function handleRequest(req, res) {
61
- const url = req.url ?? "";
62
- const method = req.method ?? "";
63
- if (method === "GET" && url === "/health") {
64
- res.writeHead(200, { "Content-Type": "application/json" });
65
- res.end(JSON.stringify({ status: "ok" }));
66
- return;
67
- }
68
- if (method === "POST" && url === "/run-conversation") {
69
- let body;
70
- try {
71
- const raw = await readBody(req);
72
- body = JSON.parse(raw);
73
- }
74
- catch (err) {
75
- const message = err instanceof Error ? err.message : String(err);
76
- res.writeHead(400, { "Content-Type": "application/json" });
77
- res.end(JSON.stringify({ error: `Invalid JSON: ${message}` }));
78
- return;
79
- }
80
- if (!body.config || !body.scenario || !body.input) {
81
- res.writeHead(400, { "Content-Type": "application/json" });
82
- res.end(JSON.stringify({ error: "Missing required fields: config, scenario, input" }));
83
- return;
84
- }
85
- try {
86
- (0, runConversation_1.log)(`HTTP request: ${body.scenario}`);
87
- const result = await (0, runConversation_1.runConversation)(body.config, body.scenario, body.input);
88
- res.writeHead(200, { "Content-Type": "application/json" });
89
- res.end(JSON.stringify(result));
90
- }
91
- catch (err) {
92
- const message = err instanceof Error ? err.message : String(err);
93
- (0, runConversation_1.logError)(`Unhandled error in runConversation: ${message}`);
94
- res.writeHead(500, { "Content-Type": "application/json" });
95
- res.end(JSON.stringify({ error: message }));
96
- }
97
- return;
98
- }
99
- res.writeHead(404, { "Content-Type": "application/json" });
100
- res.end(JSON.stringify({ error: "Not found" }));
101
- }
102
- // ─────────────────────────────────────────────────────────────────────────────
103
- // Factory
104
- // ─────────────────────────────────────────────────────────────────────────────
105
- /**
106
- * Create and start a conversation server.
107
- *
108
- * Returns a handle with the assigned port and a close() method.
109
- */
110
- async function createConversationServer(options) {
111
- const port = options?.port ?? 0;
112
- const host = options?.host ?? "127.0.0.1";
113
- const server = http.createServer((req, res) => {
114
- handleRequest(req, res).catch((err) => {
115
- (0, runConversation_1.logError)(`Request handler crashed: ${String(err)}`);
116
- if (!res.headersSent) {
117
- res.writeHead(500, { "Content-Type": "application/json" });
118
- }
119
- res.end(JSON.stringify({ error: "Internal server error" }));
120
- });
121
- });
122
- return new Promise((resolve, reject) => {
123
- server.once("error", reject);
124
- server.listen(port, host, () => {
125
- const addr = server.address();
126
- const assignedPort = typeof addr === "object" && addr ? addr.port : port;
127
- (0, runConversation_1.log)(`Server listening on http://${host}:${assignedPort}`);
128
- resolve({
129
- port: assignedPort,
130
- close: () => new Promise((res, rej) => {
131
- server.close((err) => (err ? rej(err) : res()));
132
- }),
133
- });
134
- });
135
- });
136
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"conversationTypes.d.ts","sourceRoot":"","sources":["../src/conversationTypes.ts"],"names":[],"mappings":"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"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * Type definitions for multi-turn conversation execution.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAGzF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,YAAY,EACV,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,cAAc,EAEd,UAAU,EACV,gBAAgB,EAChB,OAAO,GACR,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,YAAY,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC1F,YAAY,EACV,SAAS,EACT,aAAa,EACb,IAAI,EACJ,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
package/build/index.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateAdaptiveCard = exports.createConversationServer = exports.sendNotificationAndWait = exports.logError = exports.log = exports.runConversation = exports.LogActionType = exports.ActionType = exports.ResponseCapture = exports.ServerManager = exports.TestClient = void 0;
4
- var testClient_1 = require("./testClient");
5
- Object.defineProperty(exports, "TestClient", { enumerable: true, get: function () { return testClient_1.TestClient; } });
6
- var serverManager_1 = require("./serverManager");
7
- Object.defineProperty(exports, "ServerManager", { enumerable: true, get: function () { return serverManager_1.ServerManager; } });
8
- var responseCapture_1 = require("./responseCapture");
9
- Object.defineProperty(exports, "ResponseCapture", { enumerable: true, get: function () { return responseCapture_1.ResponseCapture; } });
10
- // Re-export WebSocket event types for consumers
11
- var types_1 = require("./types");
12
- Object.defineProperty(exports, "ActionType", { enumerable: true, get: function () { return types_1.ActionType; } });
13
- Object.defineProperty(exports, "LogActionType", { enumerable: true, get: function () { return types_1.LogActionType; } });
14
- // Conversation runner
15
- var runConversation_1 = require("./runConversation");
16
- Object.defineProperty(exports, "runConversation", { enumerable: true, get: function () { return runConversation_1.runConversation; } });
17
- Object.defineProperty(exports, "log", { enumerable: true, get: function () { return runConversation_1.log; } });
18
- Object.defineProperty(exports, "logError", { enumerable: true, get: function () { return runConversation_1.logError; } });
19
- var notificationSender_1 = require("./notificationSender");
20
- Object.defineProperty(exports, "sendNotificationAndWait", { enumerable: true, get: function () { return notificationSender_1.sendNotificationAndWait; } });
21
- var conversationServer_1 = require("./conversationServer");
22
- Object.defineProperty(exports, "createConversationServer", { enumerable: true, get: function () { return conversationServer_1.createConversationServer; } });
23
- // Adaptive Card validation
24
- var cardValidator_1 = require("./cardValidator");
25
- Object.defineProperty(exports, "validateAdaptiveCard", { enumerable: true, get: function () { return cardValidator_1.validateAdaptiveCard; } });
@@ -1 +0,0 @@
1
- {"version":3,"file":"notificationSender.d.ts","sourceRoot":"","sources":["../src/notificationSender.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAQ/D;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,aAAa,GAAG,SAAS,EAClC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAyEjB"}
@@ -1,83 +0,0 @@
1
- "use strict";
2
- /**
3
- * Notification sender for multi-turn conversation execution.
4
- *
5
- * Sends custom notification activities through the playground's Factory
6
- * infrastructure and polls ConversationManager for bot responses.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.sendNotificationAndWait = sendNotificationAndWait;
10
- const server_1 = require("server");
11
- const POLL_INTERVAL_MS = 200;
12
- function log(msg) {
13
- process.stderr.write(`[notification] ${msg}\n`);
14
- }
15
- /**
16
- * Send a notification activity and wait for the bot's response.
17
- *
18
- * The turn's turn_type must be a valid CustomActivityTemplateType
19
- * (e.g., "sendEmail", "mentionInWord"). It is passed directly to
20
- * the playground's CustomActivityService.
21
- */
22
- async function sendNotificationAndWait(conversationId, turn, persona, timeout) {
23
- const templateType = turn.turn_type;
24
- const customActivityService = server_1.Factory.getCustomActivityService();
25
- const accessor = server_1.Factory.getBaseUserBotAccessor();
26
- const conversationManager = server_1.Factory.getConversationManager();
27
- // Count existing messages before sending.
28
- const messagesBefore = conversationManager.listMessages(conversationId);
29
- const countBefore = messagesBefore.length;
30
- // Generate the activity template as a mutable plain object.
31
- const template = customActivityService.generateTemplate(conversationId, templateType);
32
- // Override the from field if a persona is provided.
33
- if (persona) {
34
- const from = (template.from ?? {});
35
- template.from = {
36
- ...from,
37
- id: persona.email ?? persona.id,
38
- name: persona.name,
39
- };
40
- }
41
- // Customize the activity body based on turn type.
42
- if (templateType === "sendEmail") {
43
- const entities = template.entities;
44
- const emailEntity = entities?.find((e) => e.type === "emailNotification");
45
- if (emailEntity) {
46
- emailEntity.htmlBody = turn.prompt;
47
- }
48
- }
49
- else if (templateType === "mentionInWord") {
50
- template.text = turn.prompt;
51
- if (turn.prompt_metadata?.documentUrl) {
52
- const attachments = template.attachments;
53
- if (attachments?.[0]) {
54
- attachments[0].contentUrl = turn.prompt_metadata.documentUrl;
55
- }
56
- }
57
- if (turn.prompt_metadata?.documentName) {
58
- const attachments = template.attachments;
59
- if (attachments?.[0]) {
60
- attachments[0].name = turn.prompt_metadata.documentName;
61
- }
62
- }
63
- }
64
- log(`Sending ${templateType} activity to conversation ${conversationId}`);
65
- // sendActivity expects the Activity class from the server's dependency tree.
66
- // We cast through unknown to bridge the inferred template type.
67
- await accessor.sendActivity(template);
68
- // Poll for new bot messages.
69
- const deadline = Date.now() + timeout;
70
- while (Date.now() < deadline) {
71
- const messages = conversationManager.listMessages(conversationId);
72
- const newBotMessages = messages.slice(countBefore).filter((m) => m.createdBy === "bot");
73
- if (newBotMessages.length > 0) {
74
- const responseText = newBotMessages
75
- .map((m) => m.content.text ?? "")
76
- .filter((t) => t.length > 0)
77
- .join("\n\n");
78
- return responseText;
79
- }
80
- await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
81
- }
82
- throw new Error(`Timeout waiting for bot response to ${templateType} after ${timeout}ms`);
83
- }
@@ -1,29 +0,0 @@
1
- import { BotConnectorService, ConversationManager, Message } from "server";
2
- /**
3
- * Captures bot responses by hooking into BotConnectorService.processActivity
4
- */
5
- export declare class ResponseCapture {
6
- private pendingResponses;
7
- private originalProcessActivity?;
8
- /**
9
- * Hook into BotConnectorService to intercept responses
10
- */
11
- hookIntoBotConnectorService(service: BotConnectorService): void;
12
- /**
13
- * Wait for a response in the given conversation
14
- */
15
- waitForResponse(conversationId: string, conversationManager: ConversationManager, timeout: number): Promise<Message[]>;
16
- /**
17
- * Resolve waiting promises when a response arrives
18
- */
19
- private resolveWaiting;
20
- /**
21
- * Clear all pending responses
22
- */
23
- clear(): void;
24
- /**
25
- * Clear pending responses for a specific conversation only
26
- */
27
- clearConversation(conversationId: string): void;
28
- }
29
- //# sourceMappingURL=responseCapture.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"responseCapture.d.ts","sourceRoot":"","sources":["../src/responseCapture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAI3E;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,gBAAgB,CAA2C;IACnE,OAAO,CAAC,uBAAuB,CAAC,CAAuD;IAEvF;;OAEG;IACH,2BAA2B,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI;IAkD/D;;OAEG;IACG,eAAe,CACnB,cAAc,EAAE,MAAM,EACtB,mBAAmB,EAAE,mBAAmB,EACxC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,EAAE,CAAC;IA6BrB;;OAEG;IACH,OAAO,CAAC,cAAc;IAqBtB;;OAEG;IACH,KAAK,IAAI,IAAI;IAOb;;OAEG;IACH,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;CAOhD"}