@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.
- package/README.md +8 -21
- package/{build → dist}/conversationTypes.d.ts +5 -0
- package/{build → dist}/index.d.ts +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.LICENSE.txt +157 -0
- package/dist/responseCapture.d.ts +42 -0
- package/{build → dist}/serverManager.d.ts +1 -2
- package/dist/start-server.js +9 -0
- package/dist/start-server.js.LICENSE.txt +157 -0
- package/{build → dist}/testClient.d.ts +1 -1
- package/{build → dist}/types.d.ts +9 -0
- package/package.json +22 -12
- package/build/cardValidator.d.ts.map +0 -1
- package/build/cardValidator.js +0 -46
- package/build/conversationServer.d.ts.map +0 -1
- package/build/conversationServer.js +0 -136
- package/build/conversationTypes.d.ts.map +0 -1
- package/build/conversationTypes.js +0 -5
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -25
- package/build/notificationSender.d.ts.map +0 -1
- package/build/notificationSender.js +0 -83
- package/build/responseCapture.d.ts +0 -29
- package/build/responseCapture.d.ts.map +0 -1
- package/build/responseCapture.js +0 -119
- package/build/runConversation.d.ts.map +0 -1
- package/build/runConversation.js +0 -351
- package/build/serverManager.d.ts.map +0 -1
- package/build/serverManager.js +0 -149
- package/build/start-server.d.ts.map +0 -1
- package/build/start-server.js +0 -23
- package/build/testClient.d.ts.map +0 -1
- package/build/testClient.js +0 -434
- package/build/types.d.ts.map +0 -1
- package/build/types.js +0 -7
- package/build/websocketClient.d.ts.map +0 -1
- package/build/websocketClient.js +0 -129
- package/src/cardValidator.ts +0 -56
- package/src/conversationServer.ts +0 -147
- package/src/conversationTypes.ts +0 -157
- package/src/index.ts +0 -37
- package/src/notificationSender.ts +0 -103
- package/src/responseCapture.ts +0 -145
- package/src/runConversation.ts +0 -382
- package/src/serverManager.ts +0 -172
- package/src/start-server.ts +0 -26
- package/src/testClient.ts +0 -512
- package/src/types.ts +0 -155
- package/src/websocketClient.ts +0 -153
- package/tsconfig.json +0 -14
- /package/{build → dist}/cardValidator.d.ts +0 -0
- /package/{build → dist}/conversationServer.d.ts +0 -0
- /package/{build → dist}/notificationSender.d.ts +0 -0
- /package/{build → dist}/runConversation.d.ts +0 -0
- /package/{build → dist}/start-server.d.ts +0 -0
- /package/{build → dist}/websocketClient.d.ts +0 -0
package/src/websocketClient.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import WebSocket from "ws";
|
|
2
|
-
import { IAction, ILogAction } from "schema";
|
|
3
|
-
|
|
4
|
-
const CONVERSATION_WS_PATH = "/_ws_conversation/v1/conversations/stream";
|
|
5
|
-
const LOG_WS_PATH = "/_ws/log/stream";
|
|
6
|
-
|
|
7
|
-
export interface WebSocketClientOptions {
|
|
8
|
-
port: number;
|
|
9
|
-
onMessage: (action: IAction) => void;
|
|
10
|
-
onError?: (error: Error) => void;
|
|
11
|
-
onClose?: () => void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface LogWebSocketClientOptions {
|
|
15
|
-
port: number;
|
|
16
|
-
onLogMessage: (action: ILogAction) => void;
|
|
17
|
-
onError?: (error: Error) => void;
|
|
18
|
-
onClose?: () => void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* WebSocket client for connecting to the conversation WebSocket endpoint.
|
|
23
|
-
* Receives real-time message and typing events from the server.
|
|
24
|
-
*/
|
|
25
|
-
export class WebSocketClient {
|
|
26
|
-
private ws: WebSocket | null = null;
|
|
27
|
-
private options: WebSocketClientOptions;
|
|
28
|
-
|
|
29
|
-
constructor(options: WebSocketClientOptions) {
|
|
30
|
-
this.options = options;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Connect to the WebSocket server
|
|
35
|
-
*/
|
|
36
|
-
connect(): Promise<void> {
|
|
37
|
-
return new Promise((resolve, reject) => {
|
|
38
|
-
const url = `ws://localhost:${this.options.port}${CONVERSATION_WS_PATH}`;
|
|
39
|
-
this.ws = new WebSocket(url);
|
|
40
|
-
|
|
41
|
-
this.ws.on("open", () => {
|
|
42
|
-
// Small delay to ensure server has processed the connection
|
|
43
|
-
setTimeout(resolve, 50);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
this.ws.on("message", (data: WebSocket.Data) => {
|
|
47
|
-
try {
|
|
48
|
-
const message = JSON.parse(data.toString()) as IAction;
|
|
49
|
-
this.options.onMessage(message);
|
|
50
|
-
} catch (err) {
|
|
51
|
-
console.error("Failed to parse WebSocket message:", err);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
this.ws.on("error", (err: Error) => {
|
|
56
|
-
if (this.options.onError) {
|
|
57
|
-
this.options.onError(err);
|
|
58
|
-
}
|
|
59
|
-
reject(err);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
this.ws.on("close", () => {
|
|
63
|
-
if (this.options.onClose) {
|
|
64
|
-
this.options.onClose();
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Close the WebSocket connection
|
|
72
|
-
*/
|
|
73
|
-
close(): void {
|
|
74
|
-
if (this.ws) {
|
|
75
|
-
this.ws.close();
|
|
76
|
-
this.ws = null;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Check if the WebSocket is connected
|
|
82
|
-
*/
|
|
83
|
-
isConnected(): boolean {
|
|
84
|
-
return this.ws !== null && this.ws.readyState === WebSocket.OPEN;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* WebSocket client for connecting to the log WebSocket endpoint.
|
|
90
|
-
* Receives real-time log events from the server.
|
|
91
|
-
*/
|
|
92
|
-
export class LogWebSocketClient {
|
|
93
|
-
private ws: WebSocket | null = null;
|
|
94
|
-
private options: LogWebSocketClientOptions;
|
|
95
|
-
|
|
96
|
-
constructor(options: LogWebSocketClientOptions) {
|
|
97
|
-
this.options = options;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Connect to the log WebSocket server
|
|
102
|
-
*/
|
|
103
|
-
connect(): Promise<void> {
|
|
104
|
-
return new Promise((resolve, reject) => {
|
|
105
|
-
const url = `ws://localhost:${this.options.port}${LOG_WS_PATH}`;
|
|
106
|
-
this.ws = new WebSocket(url);
|
|
107
|
-
|
|
108
|
-
this.ws.on("open", () => {
|
|
109
|
-
// Small delay to ensure server has processed the connection
|
|
110
|
-
setTimeout(resolve, 50);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
this.ws.on("message", (data: WebSocket.Data) => {
|
|
114
|
-
try {
|
|
115
|
-
const message = JSON.parse(data.toString()) as ILogAction;
|
|
116
|
-
this.options.onLogMessage(message);
|
|
117
|
-
} catch (err) {
|
|
118
|
-
console.error("Failed to parse log WebSocket message:", err);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
this.ws.on("error", (err: Error) => {
|
|
123
|
-
if (this.options.onError) {
|
|
124
|
-
this.options.onError(err);
|
|
125
|
-
}
|
|
126
|
-
reject(err);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
this.ws.on("close", () => {
|
|
130
|
-
if (this.options.onClose) {
|
|
131
|
-
this.options.onClose();
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Close the WebSocket connection
|
|
139
|
-
*/
|
|
140
|
-
close(): void {
|
|
141
|
-
if (this.ws) {
|
|
142
|
-
this.ws.close();
|
|
143
|
-
this.ws = null;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Check if the WebSocket is connected
|
|
149
|
-
*/
|
|
150
|
-
isConnected(): boolean {
|
|
151
|
-
return this.ws !== null && this.ws.readyState === WebSocket.OPEN;
|
|
152
|
-
}
|
|
153
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.common.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"lib": ["ES2022"],
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"target": "ES2022",
|
|
7
|
-
"rootDir": "./src",
|
|
8
|
-
"outDir": "./build",
|
|
9
|
-
"noEmit": false,
|
|
10
|
-
"declaration": true,
|
|
11
|
-
"declarationMap": true
|
|
12
|
-
},
|
|
13
|
-
"include": ["src"]
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|