shepherd-onboard 0.1.19 → 0.1.20
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/bin/shepherd-onboard.js +28 -2
- package/package.json +1 -1
package/bin/shepherd-onboard.js
CHANGED
|
@@ -19,6 +19,7 @@ const DEFAULT_MESSAGE_CHAT_SEARCH_LIMIT = 200;
|
|
|
19
19
|
const INITIAL_MESSAGE_CHAT_ROWS = 20;
|
|
20
20
|
const SHEPHERD_LOGO_PATH = join(PACKAGE_DIR, "assets", "shepherd_G_vector_136033.png");
|
|
21
21
|
const GRANOLA_API_KEYS_PATH = "/settings/integrations/api-keys";
|
|
22
|
+
const GOOGLE_WORKSPACE_DELEGATION_ADMIN_URL = "https://admin.google.com/ac/owl/domainwidedelegation";
|
|
22
23
|
const GOOGLE_WORKSPACE_DELEGATION_APP_NAME = "Shepherd";
|
|
23
24
|
const GOOGLE_WORKSPACE_DELEGATION_SERVICE_ACCOUNT_EMAIL =
|
|
24
25
|
"gigabrain-delegation@shepherd-gigabrain.iam.gserviceaccount.com";
|
|
@@ -148,6 +149,7 @@ async function runOnboarding() {
|
|
|
148
149
|
if (sources.google) {
|
|
149
150
|
console.log("\nGoogle Workspace domain-wide delegation");
|
|
150
151
|
printGoogleWorkspaceDelegationSetup(session.googleWorkspaceDelegation);
|
|
152
|
+
await openGoogleWorkspaceDelegationAdmin({ noOpen });
|
|
151
153
|
await waitForEnter("After the Google Workspace super admin authorizes Shepherd in Admin Console, press Enter.");
|
|
152
154
|
}
|
|
153
155
|
|
|
@@ -297,6 +299,16 @@ async function runAgentOnboarding() {
|
|
|
297
299
|
});
|
|
298
300
|
|
|
299
301
|
const opened = [];
|
|
302
|
+
let googleAdminConsole = null;
|
|
303
|
+
if (sources.google) {
|
|
304
|
+
googleAdminConsole = { url: GOOGLE_WORKSPACE_DELEGATION_ADMIN_URL };
|
|
305
|
+
if (!noOpen) {
|
|
306
|
+
await openGoogleWorkspaceDelegationAdmin({ noOpen: false });
|
|
307
|
+
googleAdminConsole.opened = true;
|
|
308
|
+
} else {
|
|
309
|
+
googleAdminConsole.opened = false;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
300
312
|
for (const [provider, url] of Object.entries(session.authUrls ?? {})) {
|
|
301
313
|
if (typeof url !== "string") continue;
|
|
302
314
|
if (provider === "google") continue;
|
|
@@ -315,6 +327,7 @@ async function runAgentOnboarding() {
|
|
|
315
327
|
account: publicAgentAccount(session.account),
|
|
316
328
|
opened,
|
|
317
329
|
googleWorkspaceDelegation: sources.google ? googleWorkspaceDelegationSetup(session.googleWorkspaceDelegation) : undefined,
|
|
330
|
+
googleAdminConsole,
|
|
318
331
|
granolaApiKeyPage,
|
|
319
332
|
statePath,
|
|
320
333
|
messagesChatsCommand: sources.messages ? `${agentCommand()} messages-chats` : undefined,
|
|
@@ -334,10 +347,14 @@ async function runAgentOnboarding() {
|
|
|
334
347
|
console.log(`Opened browser authorization: ${opened.join(", ")}`);
|
|
335
348
|
}
|
|
336
349
|
if (sources.google) {
|
|
350
|
+
if (googleAdminConsole?.opened) {
|
|
351
|
+
console.log(`Opened Google Admin Console: ${googleAdminConsole.url}`);
|
|
352
|
+
}
|
|
337
353
|
console.log("\nGoogle Workspace domain-wide delegation setup:");
|
|
338
354
|
printGoogleWorkspaceDelegationSetup(session.googleWorkspaceDelegation);
|
|
339
355
|
}
|
|
340
356
|
if (noOpen) {
|
|
357
|
+
if (sources.google) console.log(`Google Admin Console domain-wide delegation URL: ${GOOGLE_WORKSPACE_DELEGATION_ADMIN_URL}`);
|
|
341
358
|
for (const [provider, url] of Object.entries(session.authUrls ?? {})) {
|
|
342
359
|
if (provider === "google") continue;
|
|
343
360
|
console.log(`${provider} auth URL: ${url}`);
|
|
@@ -813,9 +830,9 @@ Add skip flags for sources the user did not select:
|
|
|
813
830
|
- --no-granola
|
|
814
831
|
- --no-messages
|
|
815
832
|
|
|
816
|
-
That command creates/reuses the customer user and org,
|
|
833
|
+
That command creates/reuses the customer user and org, opens the Google Admin Console domain-wide delegation page if Google Workspace is selected, prints Google Workspace setup values, opens Slack browser auth if selected, and saves local state.
|
|
817
834
|
|
|
818
|
-
If Google Workspace is selected,
|
|
835
|
+
If Google Workspace is selected, the setup command opens the Admin Console domain-wide delegation page. Show this setup to the user and have their Google Workspace super admin authorize it:
|
|
819
836
|
|
|
820
837
|
App name: ${payload.googleWorkspaceDelegation.appName}
|
|
821
838
|
Service account email: ${payload.googleWorkspaceDelegation.serviceAccountEmail}
|
|
@@ -1072,6 +1089,15 @@ async function openOrPrint(url, opts) {
|
|
|
1072
1089
|
});
|
|
1073
1090
|
}
|
|
1074
1091
|
|
|
1092
|
+
async function openGoogleWorkspaceDelegationAdmin(opts = {}) {
|
|
1093
|
+
if (opts.noOpen) {
|
|
1094
|
+
console.log(`Google Admin Console domain-wide delegation URL: ${GOOGLE_WORKSPACE_DELEGATION_ADMIN_URL}`);
|
|
1095
|
+
return { opened: false, url: GOOGLE_WORKSPACE_DELEGATION_ADMIN_URL };
|
|
1096
|
+
}
|
|
1097
|
+
await openOrPrint(GOOGLE_WORKSPACE_DELEGATION_ADMIN_URL, { noOpen: false });
|
|
1098
|
+
return { opened: true, url: GOOGLE_WORKSPACE_DELEGATION_ADMIN_URL };
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1075
1101
|
async function openGranolaApiKeys(opts = {}) {
|
|
1076
1102
|
const deepLink = granolaApiKeysDeepLink();
|
|
1077
1103
|
if (opts.noOpen) {
|