Skip to content

Commit 70b9068

Browse files
committed
ran prettier
1 parent 74b6a41 commit 70b9068

23 files changed

+294
-213
lines changed

ts/jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ module.exports = {
88
moduleNameMapper: {
99
"^../src/(.*)$": "<rootDir>/dist/$1",
1010
},
11-
testTimeout: 30000
11+
testTimeout: 30000,
1212
};

ts/packages/agentSdk/src/display.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ export type DisplayMessageKind =
2626

2727
export type DisplayAppendMode = "inline" | "block" | "temporary";
2828

29-
export type ClientAction = "show-camera" | "open-app" | "show-notification" | "start-intent" | "set-alarm";
29+
export type ClientAction =
30+
| "show-camera"
31+
| "open-app"
32+
| "show-notification"
33+
| "start-intent"
34+
| "set-alarm";
3035

3136
export interface ActionIO {
3237
readonly type: DisplayType;

ts/packages/agents/androidMobile/src/androidMobileSchema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export type SetAlarmAction = {
1010
// the original request of the user
1111
originalRequest: string;
1212
// the time for the alarm in the format YYYY-mm-ddThh:mm:ss (i.e. 2024-02-15T08:30:15 )
13-
time: string
13+
time: string;
1414
};
1515
};
1616

ts/packages/api/src/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ assert(envPath, ".env file not found!");
1010

1111
const typeAgentServer: TypeAgentServer = new TypeAgentServer(envPath);
1212
typeAgentServer.start();
13-

ts/packages/api/src/typeAgentServer.ts

+12-5
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ import {
1111
import { WebAPIClientIO } from "./webClientIO.js";
1212
import { TypeAgentAPIWebSocketServer } from "./webSocketServer.js";
1313

14-
1514
export class TypeAgentServer {
1615
private dispatcher: Dispatcher | undefined;
1716
private webClientIO: WebAPIClientIO | undefined;
1817
private webSocketServer: TypeAgentAPIWebSocketServer | undefined;
1918
private webServer: TypeAgentAPIWebServer | undefined;
2019

21-
constructor(private envPath: string, private wsPort: number = 3030) {
20+
constructor(
21+
private envPath: string,
22+
private wsPort: number = 3030,
23+
) {
2224
// typeAgent config
2325
dotenv.config({ path: this.envPath });
2426
}
@@ -36,9 +38,14 @@ export class TypeAgentServer {
3638
});
3739

3840
// websocket server
39-
const hostEndpoint = process.env["WEBSOCKET_HOST"] ?? `ws://localhost:${this.wsPort}`;
41+
const hostEndpoint =
42+
process.env["WEBSOCKET_HOST"] ?? `ws://localhost:${this.wsPort}`;
4043
const url = new URL(hostEndpoint);
41-
this.webSocketServer = new TypeAgentAPIWebSocketServer(url, this.dispatcher, this.webClientIO!);
44+
this.webSocketServer = new TypeAgentAPIWebSocketServer(
45+
url,
46+
this.dispatcher,
47+
this.webClientIO!,
48+
);
4249

4350
// web server config
4451
const config: TypeAgentAPIServerConfig = JSON.parse(
@@ -54,4 +61,4 @@ export class TypeAgentServer {
5461
this.webServer?.stop();
5562
this.webSocketServer?.stop();
5663
}
57-
}
64+
}

ts/packages/api/test/api.spec.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import { TypeAgentServer } from "../src/typeAgentServer.js";
66
import findConfig from "find-config";
77

88
describe("api web/ws server", () => {
9-
109
it("verify web server respnses", async () => {
11-
1210
const envPath = findConfig(".env");
1311
if (envPath !== null) {
1412
assert(envPath, ".env file not found!");
15-
const typeAgentServer: TypeAgentServer = new TypeAgentServer(envPath!);
13+
const typeAgentServer: TypeAgentServer = new TypeAgentServer(
14+
envPath!,
15+
);
1616
await typeAgentServer.start();
1717

1818
let response = await fetch("http://localhost:3000/");
@@ -26,8 +26,9 @@ describe("api web/ws server", () => {
2626

2727
typeAgentServer.stop();
2828
} else {
29-
console.warn("Skipping test 'verify web server respnses', no .env file!");
29+
console.warn(
30+
"Skipping test 'verify web server respnses', no .env file!",
31+
);
3032
}
31-
})
33+
});
3234
});
33-

ts/packages/dispatcher/src/agent/agentProcess.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ function getActionContextShim(
371371
rpc.send("takeAction", {
372372
actionContextId,
373373
action,
374-
data
374+
data,
375375
});
376376
},
377377
};

ts/packages/dispatcher/src/agent/agentProcessShim.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
CommandDescriptors,
1414
ParsedCommandParams,
1515
ParameterDefinitions,
16-
ClientAction
16+
ClientAction,
1717
} from "@typeagent/agent-sdk";
1818
import {
1919
AgentCallFunctions,
@@ -244,7 +244,11 @@ export async function createAgentProcessShim(
244244
.get(param.actionContextId)
245245
.actionIO.appendDisplay(param.content, param.mode);
246246
},
247-
takeAction: (param: { actionContextId: number; action: ClientAction, data?: unknown }) => {
247+
takeAction: (param: {
248+
actionContextId: number;
249+
action: ClientAction;
250+
data?: unknown;
251+
}) => {
248252
actionContextMap
249253
.get(param.actionContextId)
250254
.actionIO.takeAction(param.action, param.data);

ts/packages/dispatcher/src/agent/agentProcessTypes.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ export type AgentContextCallFunctions = {
3333
content: DisplayContent;
3434
mode: DisplayAppendMode;
3535
}) => void;
36-
takeAction: (param: { actionContextId: number; action: ClientAction, data?: unknown }) => void;
36+
takeAction: (param: {
37+
actionContextId: number;
38+
action: ClientAction;
39+
data?: unknown;
40+
}) => void;
3741
};
3842

3943
export type AgentContextInvokeFunctions = {

ts/packages/shell/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"typechat": "^0.1.1",
4646
"ws": "^8.17.1"
4747
},
48-
"devDependencies": {
48+
"devDependencies": {
4949
"@electron-toolkit/tsconfig": "^1.0.1",
5050
"@types/debug": "^4.1.10",
5151
"@types/dompurify": "^3.0.5",

ts/packages/shell/src/main/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { AppAgentEvent, DisplayAppendMode } from "@typeagent/agent-sdk";
3333
import { shellAgentProvider } from "./agent.js";
3434
import { BrowserAgentIpc } from "./browserIpc.js";
3535
import { WebSocketMessage } from "common-utils";
36-
import { AzureSpeech } from "./azureSpeech.js"
36+
import { AzureSpeech } from "./azureSpeech.js";
3737
import { auth } from "aiclient";
3838

3939
console.log(auth.AzureTokenScopes.CogServices);

ts/packages/shell/src/preload/electronTypes.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ export interface ClientSettingsProvider {
3939

4040
export type DisplayType = "html" | "iframe" | "text";
4141

42-
export type ClientActions = "show-camera" | "open-app" | "show-notification" | "start-intent";
42+
export type ClientActions =
43+
| "show-camera"
44+
| "open-app"
45+
| "show-notification"
46+
| "start-intent";
4347

4448
// end duplicate type section
4549

@@ -187,7 +191,11 @@ export interface ClientAPI {
187191
) => void,
188192
): void;
189193
onTakeAction(
190-
callback: (e: Electron.IpcRendererEvent, action: string, data: unknown) => void,
194+
callback: (
195+
e: Electron.IpcRendererEvent,
196+
action: string,
197+
data: unknown,
198+
) => void,
191199
);
192200
}
193201

ts/packages/shell/src/renderer/index.html

+46-25
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
<link href="./assets/cameraStyles.less" type="text/css" rel="stylesheet" />
1616
<link href="./assets/carousel.less" type="text/css" rel="stylesheet" />
1717
<link href="./assets/loading.less" type="text/css" rel="stylesheet" />
18-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
19-
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
20-
18+
<link
19+
rel="stylesheet"
20+
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
21+
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
22+
crossorigin="anonymous"
23+
/>
2124
</head>
2225
<body>
2326
<script type="module" src="./src/main.ts"></script>
@@ -26,43 +29,61 @@
2629
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
2730
<a class="navbar-brand" href="/">Microsoft identity platform</a>
2831
<div class="btn-group ml-auto dropleft">
29-
<button type="button" id="SignIn" class="btn btn-secondary" onclick="signIn()">
32+
<button
33+
type="button"
34+
id="SignIn"
35+
class="btn btn-secondary"
36+
onclick="signIn()"
37+
>
3038
Sign In
3139
</button>
3240
</div>
3341
</nav>
34-
<br>
35-
<h5 class="card-header text-center">Vanilla JavaScript SPA calling MS Graph API with MSAL.js</h5>
36-
<br>
37-
<div class="row" style="margin:auto">
38-
<div id="card-div" class="col-md-3" style="display:none">
42+
<br />
43+
<h5 class="card-header text-center">
44+
Vanilla JavaScript SPA calling MS Graph API with MSAL.js
45+
</h5>
46+
<br />
47+
<div class="row" style="margin: auto">
48+
<div id="card-div" class="col-md-3" style="display: none">
3949
<div class="card text-center">
4050
<div class="card-body">
41-
<h5 class="card-title" id="WelcomeMessage">Please sign-in to see your profile and read your mails</h5>
51+
<h5 class="card-title" id="WelcomeMessage">
52+
Please sign-in to see your profile and read your mails
53+
</h5>
4254
<div id="profile-div"></div>
43-
<br>
44-
<br>
45-
<button class="btn btn-primary" id="seeProfile" onclick="seeProfile()">See Profile</button>
46-
<br>
47-
<br>
48-
<button class="btn btn-primary" id="readMail" onclick="readMail()">Read Mails</button>
55+
<br />
56+
<br />
57+
<button
58+
class="btn btn-primary"
59+
id="seeProfile"
60+
onclick="seeProfile()"
61+
>
62+
See Profile
63+
</button>
64+
<br />
65+
<br />
66+
<button
67+
class="btn btn-primary"
68+
id="readMail"
69+
onclick="readMail()"
70+
>
71+
Read Mails
72+
</button>
4973
</div>
5074
</div>
5175
</div>
52-
<br>
53-
<br>
76+
<br />
77+
<br />
5478
<div class="col-md-4">
55-
<div class="list-group" id="list-tab" role="tablist">
56-
</div>
79+
<div class="list-group" id="list-tab" role="tablist"></div>
5780
</div>
5881
<div class="col-md-5">
59-
<div class="tab-content" id="nav-tabContent">
60-
</div>
82+
<div class="tab-content" id="nav-tabContent"></div>
6183
</div>
6284
</div>
63-
<br>
64-
<br>
65-
85+
<br />
86+
<br />
6687
</div>
6788
</body>
6889
</html>
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,57 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
import * as msal from "@azure/msal-browser"
4+
import * as msal from "@azure/msal-browser";
55

66
/**
7-
* Configuration object to be passed to MSAL instance on creation.
7+
* Configuration object to be passed to MSAL instance on creation.
88
* For a full list of MSAL.js configuration parameters, visit:
9-
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md
9+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md
1010
*/
1111
export const msalConfig = {
1212
auth: {
1313
// 'Application (client) ID' of app registration in Azure portal - this value is a GUID
1414
clientId: "de5757b7-986f-4f02-aea1-395670da6da0",
1515
//clientId: "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
1616
// Full directory URL, in the form of https://login.microsoftonline.com/<tenant-id>
17-
authority: "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47",
17+
authority:
18+
"https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47",
1819
// Full redirect URL, in form of http://localhost:3000
1920
redirectUri: "http://localhost:3000/",
2021
},
2122
cache: {
2223
cacheLocation: "sessionStorage", // This configures where your cache will be stored
2324
storeAuthStateInCookie: false, // Set this to "true" if you are having issues on IE11 or Edge
2425
},
25-
system: {
26-
loggerOptions: {
27-
loggerCallback: (level, message, containsPii) => {
28-
if (containsPii) {
29-
return;
30-
}
31-
switch (level) {
32-
case msal.LogLevel.Error:
33-
console.error(message);
34-
return;
35-
case msal.LogLevel.Info:
36-
console.info(message);
37-
return;
38-
case msal.LogLevel.Verbose:
39-
console.debug(message);
40-
return;
41-
case msal.LogLevel.Warning:
42-
console.warn(message);
43-
return;
44-
}
45-
}
46-
}
47-
}
26+
system: {
27+
loggerOptions: {
28+
loggerCallback: (level, message, containsPii) => {
29+
if (containsPii) {
30+
return;
31+
}
32+
switch (level) {
33+
case msal.LogLevel.Error:
34+
console.error(message);
35+
return;
36+
case msal.LogLevel.Info:
37+
console.info(message);
38+
return;
39+
case msal.LogLevel.Verbose:
40+
console.debug(message);
41+
return;
42+
case msal.LogLevel.Warning:
43+
console.warn(message);
44+
return;
45+
}
46+
},
47+
},
48+
},
4849
};
4950

5051
/**
5152
* Scopes you add here will be prompted for user consent during sign-in.
5253
* By default, MSAL.js will add OIDC scopes (openid, profile, email) to any login request.
53-
* For more information about OIDC scopes, visit:
54+
* For more information about OIDC scopes, visit:
5455
* https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#openid-connect-scopes
5556
*/
5657
export const loginRequest = {
@@ -63,5 +64,5 @@ export const loginRequest = {
6364
*/
6465
export const tokenRequest = {
6566
scopes: ["https://cognitiveservices.azure.com/.default"],
66-
forceRefresh: false // Set this to "true" to skip a cached token and go to the server to get a new token
67+
forceRefresh: false, // Set this to "true" to skip a cached token and go to the server to get a new token
6768
};

0 commit comments

Comments
 (0)