crewly 1.6.0 → 1.6.1
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/config/roles/orchestrator/fragments/role-boundary.md +4 -1
- package/config/roles/orchestrator/prompt.md +37 -0
- package/config/roles/orchestrator/soul.md +47 -10
- package/config/skills/_common/lib.sh +28 -0
- package/config/skills/agent/core/cancel-followup/execute.sh +0 -19
- package/config/skills/agent/core/list-my-followups/execute.sh +0 -19
- package/config/skills/agent/core/schedule-followup/execute.sh +0 -19
- package/config/skills/agent/core/watch-for-event/execute.sh +0 -19
- package/config/skills/orchestrator/credential-manager/execute.test.sh +88 -0
- package/dist/backend/backend/src/config/oauth.config.d.ts +33 -0
- package/dist/backend/backend/src/config/oauth.config.d.ts.map +1 -0
- package/dist/backend/backend/src/config/oauth.config.js +45 -0
- package/dist/backend/backend/src/config/oauth.config.js.map +1 -0
- package/dist/backend/backend/src/controllers/credentials/credentials.controller.d.ts +0 -26
- package/dist/backend/backend/src/controllers/credentials/credentials.controller.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/credentials/credentials.controller.js +47 -184
- package/dist/backend/backend/src/controllers/credentials/credentials.controller.js.map +1 -1
- package/dist/backend/backend/src/controllers/credentials/credentials.routes.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/credentials/credentials.routes.js +2 -1
- package/dist/backend/backend/src/controllers/credentials/credentials.routes.js.map +1 -1
- package/dist/backend/backend/src/controllers/credentials/google-oauth.controller.d.ts +40 -0
- package/dist/backend/backend/src/controllers/credentials/google-oauth.controller.d.ts.map +1 -0
- package/dist/backend/backend/src/controllers/credentials/google-oauth.controller.js +162 -0
- package/dist/backend/backend/src/controllers/credentials/google-oauth.controller.js.map +1 -0
- package/dist/backend/backend/src/controllers/skill/skill.controller.d.ts.map +1 -1
- package/dist/backend/backend/src/controllers/skill/skill.controller.js +1 -0
- package/dist/backend/backend/src/controllers/skill/skill.controller.js.map +1 -1
- package/dist/backend/backend/src/index.d.ts.map +1 -1
- package/dist/backend/backend/src/index.js +23 -4
- package/dist/backend/backend/src/index.js.map +1 -1
- package/dist/backend/backend/src/routes/api.routes.d.ts.map +1 -1
- package/dist/backend/backend/src/routes/api.routes.js +3 -0
- package/dist/backend/backend/src/routes/api.routes.js.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/role-boundary.module.d.ts.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/role-boundary.module.js +4 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/role-boundary.module.js.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.d.ts.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js +17 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js.map +1 -1
- package/dist/backend/backend/src/services/credential/helpers/gemini-cli-workspace.helper.d.ts +4 -16
- package/dist/backend/backend/src/services/credential/helpers/gemini-cli-workspace.helper.d.ts.map +1 -1
- package/dist/backend/backend/src/services/credential/helpers/gemini-cli-workspace.helper.js +7 -28
- package/dist/backend/backend/src/services/credential/helpers/gemini-cli-workspace.helper.js.map +1 -1
- package/dist/backend/backend/src/services/mcp-server.d.ts +46 -2
- package/dist/backend/backend/src/services/mcp-server.d.ts.map +1 -1
- package/dist/backend/backend/src/services/mcp-server.js +216 -211
- package/dist/backend/backend/src/services/mcp-server.js.map +1 -1
- package/dist/backend/backend/src/services/mcp-tool-definitions.d.ts +254 -0
- package/dist/backend/backend/src/services/mcp-tool-definitions.d.ts.map +1 -0
- package/dist/backend/backend/src/services/mcp-tool-definitions.js +285 -0
- package/dist/backend/backend/src/services/mcp-tool-definitions.js.map +1 -0
- package/dist/backend/backend/src/services/project/task.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/project/task.service.js +5 -0
- package/dist/backend/backend/src/services/project/task.service.js.map +1 -1
- package/dist/backend/backend/src/services/skill/skill-executor.service.d.ts +41 -0
- package/dist/backend/backend/src/services/skill/skill-executor.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/skill/skill-executor.service.js +136 -7
- package/dist/backend/backend/src/services/skill/skill-executor.service.js.map +1 -1
- package/dist/backend/backend/src/services/skill/skill.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/skill/skill.service.js +1 -0
- package/dist/backend/backend/src/services/skill/skill.service.js.map +1 -1
- package/dist/backend/backend/src/types/skill.types.d.ts +9 -0
- package/dist/backend/backend/src/types/skill.types.d.ts.map +1 -1
- package/dist/backend/backend/src/types/skill.types.js.map +1 -1
- package/dist/backend/backend/src/utils/google-userinfo.utils.d.ts +41 -0
- package/dist/backend/backend/src/utils/google-userinfo.utils.d.ts.map +1 -0
- package/dist/backend/backend/src/utils/google-userinfo.utils.js +44 -0
- package/dist/backend/backend/src/utils/google-userinfo.utils.js.map +1 -0
- package/dist/cli/backend/src/config/oauth.config.d.ts +33 -0
- package/dist/cli/backend/src/config/oauth.config.d.ts.map +1 -0
- package/dist/cli/backend/src/config/oauth.config.js +45 -0
- package/dist/cli/backend/src/config/oauth.config.js.map +1 -0
- package/dist/cli/backend/src/services/credential/helpers/gemini-cli-workspace.helper.d.ts +4 -16
- package/dist/cli/backend/src/services/credential/helpers/gemini-cli-workspace.helper.d.ts.map +1 -1
- package/dist/cli/backend/src/services/credential/helpers/gemini-cli-workspace.helper.js +7 -28
- package/dist/cli/backend/src/services/credential/helpers/gemini-cli-workspace.helper.js.map +1 -1
- package/dist/cli/backend/src/services/mcp-server.d.ts +46 -2
- package/dist/cli/backend/src/services/mcp-server.d.ts.map +1 -1
- package/dist/cli/backend/src/services/mcp-server.js +216 -211
- package/dist/cli/backend/src/services/mcp-server.js.map +1 -1
- package/dist/cli/backend/src/services/mcp-tool-definitions.d.ts +254 -0
- package/dist/cli/backend/src/services/mcp-tool-definitions.d.ts.map +1 -0
- package/dist/cli/backend/src/services/mcp-tool-definitions.js +285 -0
- package/dist/cli/backend/src/services/mcp-tool-definitions.js.map +1 -0
- package/dist/cli/backend/src/services/skill/skill-executor.service.d.ts +18 -0
- package/dist/cli/backend/src/services/skill/skill-executor.service.d.ts.map +1 -1
- package/dist/cli/backend/src/services/skill/skill-executor.service.js +7 -9
- package/dist/cli/backend/src/services/skill/skill-executor.service.js.map +1 -1
- package/dist/cli/backend/src/types/skill.types.d.ts +9 -0
- package/dist/cli/backend/src/types/skill.types.d.ts.map +1 -1
- package/dist/cli/backend/src/types/skill.types.js.map +1 -1
- package/dist/cli/backend/src/utils/google-userinfo.utils.d.ts +41 -0
- package/dist/cli/backend/src/utils/google-userinfo.utils.d.ts.map +1 -0
- package/dist/cli/backend/src/utils/google-userinfo.utils.js +44 -0
- package/dist/cli/backend/src/utils/google-userinfo.utils.js.map +1 -0
- package/frontend/dist/assets/{index-9e6d97d1.js → index-70356616.js} +202 -202
- package/frontend/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Userinfo Helper
|
|
3
|
+
*
|
|
4
|
+
* Fetches the signed-in user's email from Google's userinfo endpoint given a
|
|
5
|
+
* valid OAuth access token. Best-effort: returns `undefined` on network or
|
|
6
|
+
* HTTP error so callers can proceed without an account email when the grant
|
|
7
|
+
* is still valid.
|
|
8
|
+
*
|
|
9
|
+
* Used by both the credentials controller (headless OAuth completion) and
|
|
10
|
+
* the Gemini CLI Workspace helper (token capture) so the fetch + parsing
|
|
11
|
+
* logic lives in one place.
|
|
12
|
+
*
|
|
13
|
+
* @module utils/google-userinfo.utils
|
|
14
|
+
*/
|
|
15
|
+
import { GOOGLE_USERINFO_ENDPOINT } from '../config/oauth.config.js';
|
|
16
|
+
/**
|
|
17
|
+
* Fetch the account email associated with the given OAuth access token.
|
|
18
|
+
*
|
|
19
|
+
* Best-effort: returns `undefined` on network failure, non-2xx response,
|
|
20
|
+
* or a response missing the `email` field. Never throws.
|
|
21
|
+
*
|
|
22
|
+
* @param accessToken - A valid Google OAuth access token with a scope that
|
|
23
|
+
* grants `userinfo.email` (e.g. openid/email).
|
|
24
|
+
* @param fetchImpl - Injectable fetch (defaults to the global `fetch`).
|
|
25
|
+
* @returns The account email, or `undefined` if it cannot be determined.
|
|
26
|
+
*/
|
|
27
|
+
export async function fetchGoogleAccountEmail(accessToken, fetchImpl) {
|
|
28
|
+
const doFetch = fetchImpl ??
|
|
29
|
+
((url, init) => fetch(url, init));
|
|
30
|
+
try {
|
|
31
|
+
const response = await doFetch(GOOGLE_USERINFO_ENDPOINT, {
|
|
32
|
+
method: 'GET',
|
|
33
|
+
headers: { Authorization: `Bearer ${accessToken}` },
|
|
34
|
+
});
|
|
35
|
+
if (!response.ok)
|
|
36
|
+
return undefined;
|
|
37
|
+
const data = (await response.json());
|
|
38
|
+
return data.email;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=google-userinfo.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-userinfo.utils.js","sourceRoot":"","sources":["../../../../../backend/src/utils/google-userinfo.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAoBrE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,WAAmB,EACnB,SAAqB;IAErB,MAAM,OAAO,GACX,SAAS;QACT,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CACb,KAAK,CAAC,GAAG,EAAE,IAAmB,CAAqC,CAAC,CAAC;IAEzE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,wBAAwB,EAAE;YACvD,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,WAAW,EAAE,EAAE;SACpD,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,OAAO,SAAS,CAAC;QACnC,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAuB,CAAC;QAC3D,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google OAuth Configuration
|
|
3
|
+
*
|
|
4
|
+
* Shared constants for the Google OAuth flows that piggyback on the Gemini
|
|
5
|
+
* CLI Workspace extension's published OAuth app. Defining these here lets
|
|
6
|
+
* the REST controller (URL-builder) and the helper (refresh client) stay in
|
|
7
|
+
* sync on client_id / redirect_uri / endpoints.
|
|
8
|
+
*
|
|
9
|
+
* These values come from the Gemini CLI Workspace extension's
|
|
10
|
+
* `workspace-server/src/utils/config.ts` — using the same client_id
|
|
11
|
+
* + redirect_uri lets us avoid the 7-day testing-mode grant expiry.
|
|
12
|
+
*
|
|
13
|
+
* @module config/oauth.config
|
|
14
|
+
*/
|
|
15
|
+
/** OAuth client_id for the Gemini CLI Workspace extension's published app. */
|
|
16
|
+
export declare const GOOGLE_OAUTH_CLIENT_ID = "338689075775-o75k922vn5fdl18qergr96rp8g63e4d7.apps.googleusercontent.com";
|
|
17
|
+
/** Redirect URI the Gemini CLI Workspace cloud function is registered for. */
|
|
18
|
+
export declare const GOOGLE_OAUTH_REDIRECT_URI = "https://google-workspace-extension.geminicli.com";
|
|
19
|
+
/** Base URL of Google's OAuth 2.0 authorization endpoint. */
|
|
20
|
+
export declare const GOOGLE_OAUTH_AUTH_BASE = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
21
|
+
/** Cloud Function base URL where the extension's `/refreshToken` lives. */
|
|
22
|
+
export declare const GEMINI_CLI_CLOUD_FUNCTION_URL = "https://google-workspace-extension.geminicli.com";
|
|
23
|
+
/** Path on the cloud function used for token refresh calls. */
|
|
24
|
+
export declare const GEMINI_CLI_REFRESH_PATH = "/refreshToken";
|
|
25
|
+
/** Google's userinfo endpoint — used to resolve an OAuth token's account email. */
|
|
26
|
+
export declare const GOOGLE_USERINFO_ENDPOINT = "https://www.googleapis.com/oauth2/v3/userinfo";
|
|
27
|
+
/**
|
|
28
|
+
* Default scope set for a broad Workspace grant — covers the common Gmail,
|
|
29
|
+
* Drive, Docs, Calendar, and Photos read paths used by marketplace skills.
|
|
30
|
+
* Callers of `/oauth/google/start` may override via the request body.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DEFAULT_GOOGLE_SCOPES: readonly string[];
|
|
33
|
+
//# sourceMappingURL=oauth.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.config.d.ts","sourceRoot":"","sources":["../../../../../backend/src/config/oauth.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,6EACyC,CAAC;AAE7E,8EAA8E;AAC9E,eAAO,MAAM,yBAAyB,qDACc,CAAC;AAErD,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,iDACa,CAAC;AAEjD,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,qDACU,CAAC;AAErD,+DAA+D;AAC/D,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAEvD,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,kDACY,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAYlD,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google OAuth Configuration
|
|
3
|
+
*
|
|
4
|
+
* Shared constants for the Google OAuth flows that piggyback on the Gemini
|
|
5
|
+
* CLI Workspace extension's published OAuth app. Defining these here lets
|
|
6
|
+
* the REST controller (URL-builder) and the helper (refresh client) stay in
|
|
7
|
+
* sync on client_id / redirect_uri / endpoints.
|
|
8
|
+
*
|
|
9
|
+
* These values come from the Gemini CLI Workspace extension's
|
|
10
|
+
* `workspace-server/src/utils/config.ts` — using the same client_id
|
|
11
|
+
* + redirect_uri lets us avoid the 7-day testing-mode grant expiry.
|
|
12
|
+
*
|
|
13
|
+
* @module config/oauth.config
|
|
14
|
+
*/
|
|
15
|
+
/** OAuth client_id for the Gemini CLI Workspace extension's published app. */
|
|
16
|
+
export const GOOGLE_OAUTH_CLIENT_ID = '338689075775-o75k922vn5fdl18qergr96rp8g63e4d7.apps.googleusercontent.com';
|
|
17
|
+
/** Redirect URI the Gemini CLI Workspace cloud function is registered for. */
|
|
18
|
+
export const GOOGLE_OAUTH_REDIRECT_URI = 'https://google-workspace-extension.geminicli.com';
|
|
19
|
+
/** Base URL of Google's OAuth 2.0 authorization endpoint. */
|
|
20
|
+
export const GOOGLE_OAUTH_AUTH_BASE = 'https://accounts.google.com/o/oauth2/v2/auth';
|
|
21
|
+
/** Cloud Function base URL where the extension's `/refreshToken` lives. */
|
|
22
|
+
export const GEMINI_CLI_CLOUD_FUNCTION_URL = 'https://google-workspace-extension.geminicli.com';
|
|
23
|
+
/** Path on the cloud function used for token refresh calls. */
|
|
24
|
+
export const GEMINI_CLI_REFRESH_PATH = '/refreshToken';
|
|
25
|
+
/** Google's userinfo endpoint — used to resolve an OAuth token's account email. */
|
|
26
|
+
export const GOOGLE_USERINFO_ENDPOINT = 'https://www.googleapis.com/oauth2/v3/userinfo';
|
|
27
|
+
/**
|
|
28
|
+
* Default scope set for a broad Workspace grant — covers the common Gmail,
|
|
29
|
+
* Drive, Docs, Calendar, and Photos read paths used by marketplace skills.
|
|
30
|
+
* Callers of `/oauth/google/start` may override via the request body.
|
|
31
|
+
*/
|
|
32
|
+
export const DEFAULT_GOOGLE_SCOPES = [
|
|
33
|
+
'openid',
|
|
34
|
+
'https://www.googleapis.com/auth/userinfo.email',
|
|
35
|
+
'https://www.googleapis.com/auth/userinfo.profile',
|
|
36
|
+
'https://www.googleapis.com/auth/gmail.readonly',
|
|
37
|
+
'https://www.googleapis.com/auth/gmail.send',
|
|
38
|
+
'https://www.googleapis.com/auth/drive.readonly',
|
|
39
|
+
'https://www.googleapis.com/auth/drive.file',
|
|
40
|
+
'https://www.googleapis.com/auth/documents.readonly',
|
|
41
|
+
'https://www.googleapis.com/auth/calendar.readonly',
|
|
42
|
+
'https://www.googleapis.com/auth/calendar.events',
|
|
43
|
+
'https://www.googleapis.com/auth/photoslibrary.readonly',
|
|
44
|
+
];
|
|
45
|
+
//# sourceMappingURL=oauth.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.config.js","sourceRoot":"","sources":["../../../../../backend/src/config/oauth.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,sBAAsB,GACjC,0EAA0E,CAAC;AAE7E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,yBAAyB,GACpC,kDAAkD,CAAC;AAErD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,sBAAsB,GACjC,8CAA8C,CAAC;AAEjD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,6BAA6B,GACxC,kDAAkD,CAAC;AAErD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEvD,mFAAmF;AACnF,MAAM,CAAC,MAAM,wBAAwB,GACnC,+CAA+C,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD,QAAQ;IACR,gDAAgD;IAChD,kDAAkD;IAClD,gDAAgD;IAChD,4CAA4C;IAC5C,gDAAgD;IAChD,4CAA4C;IAC5C,oDAAoD;IACpD,mDAAmD;IACnD,iDAAiD;IACjD,wDAAwD;CACzD,CAAC"}
|
|
@@ -19,19 +19,12 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { CredentialHelper, CredentialHelperName, CredentialRegistryEntry, GoogleOAuthPayload } from '../../../types/credential.types.js';
|
|
21
21
|
import { CredentialStoreService } from '../credential-store.service.js';
|
|
22
|
+
import { FetchLike as UserinfoFetchLike } from '../../../utils/google-userinfo.utils.js';
|
|
22
23
|
/**
|
|
23
|
-
* Minimal fetch-compatible function shape (for test injection).
|
|
24
|
+
* Minimal fetch-compatible function shape (for test injection). Re-exported
|
|
25
|
+
* from the google-userinfo utility so callers can import a single type.
|
|
24
26
|
*/
|
|
25
|
-
export type FetchLike =
|
|
26
|
-
method?: string;
|
|
27
|
-
headers?: Record<string, string>;
|
|
28
|
-
body?: string;
|
|
29
|
-
}) => Promise<{
|
|
30
|
-
ok: boolean;
|
|
31
|
-
status: number;
|
|
32
|
-
text(): Promise<string>;
|
|
33
|
-
json(): Promise<unknown>;
|
|
34
|
-
}>;
|
|
27
|
+
export type FetchLike = UserinfoFetchLike;
|
|
35
28
|
/**
|
|
36
29
|
* Helper configuration — all fields optional; defaults match production.
|
|
37
30
|
*/
|
|
@@ -98,11 +91,6 @@ export declare class GeminiCliWorkspaceHelper implements CredentialHelper {
|
|
|
98
91
|
* format (AES-256-GCM).
|
|
99
92
|
*/
|
|
100
93
|
private decryptExtensionFormat;
|
|
101
|
-
/**
|
|
102
|
-
* Fetch the user's email via Google's userinfo endpoint. Best-effort;
|
|
103
|
-
* returns undefined on failure.
|
|
104
|
-
*/
|
|
105
|
-
private fetchUserEmail;
|
|
106
94
|
}
|
|
107
95
|
/**
|
|
108
96
|
* Encrypt a plaintext string with the extension's file format. Used in
|
package/dist/cli/backend/src/services/credential/helpers/gemini-cli-workspace.helper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-cli-workspace.helper.d.ts","sourceRoot":"","sources":["../../../../../../../backend/src/services/credential/helpers/gemini-cli-workspace.helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAEnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"gemini-cli-workspace.helper.d.ts","sourceRoot":"","sources":["../../../../../../../backend/src/services/credential/helpers/gemini-cli-workspace.helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAEnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAMxE,OAAO,EAEL,SAAS,IAAI,iBAAiB,EAC/B,MAAM,yCAAyC,CAAC;AA2CjD;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,iBAAiB,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,kGAAkG;IAClG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+BAA+B;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mDAAmD;IACnD,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAMD;;;GAGG;AACH,qBAAa,wBAAyB,YAAW,gBAAgB;IAC/D,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAA0B;IAE7D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAY;IACpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;IAE/C,mFAAmF;IACnF,OAAO,CAAC,QAAQ,CAAC,eAAe,CAG5B;IACJ,oEAAoE;IACpE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6B;gBAG9D,KAAK,EAAE,sBAAsB,EAC7B,MAAM,CAAC,EAAE,qBAAqB;IAkBhC;;;;;;OAMG;IACG,eAAe,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAoEpD;;;;;;OAMG;IACG,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAczC;;;;;;;OAOG;IACG,cAAc,CAClB,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,kBAAkB,CAAC;YA4BhB,SAAS;IAuEvB;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CAoB/B;AAMD;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GACV,MAAM,CAOR;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGtE"}
|
|
@@ -22,8 +22,10 @@ import path from 'path';
|
|
|
22
22
|
import os from 'os';
|
|
23
23
|
import crypto from 'crypto';
|
|
24
24
|
import { CredentialRevokedError, } from '../../../types/credential.types.js';
|
|
25
|
+
import { GEMINI_CLI_CLOUD_FUNCTION_URL, GEMINI_CLI_REFRESH_PATH, GOOGLE_OAUTH_CLIENT_ID, } from '../../../config/oauth.config.js';
|
|
26
|
+
import { fetchGoogleAccountEmail, } from '../../../utils/google-userinfo.utils.js';
|
|
25
27
|
// ============================================================================
|
|
26
|
-
// Constants —
|
|
28
|
+
// Constants — extension-specific file layout and refresh tuning
|
|
27
29
|
// (github.com/gemini-cli-extensions/workspace)
|
|
28
30
|
// ============================================================================
|
|
29
31
|
const DEFAULT_EXTENSION_PATH = path.join(os.homedir(), '.gemini', 'extensions', 'google-workspace');
|
|
@@ -31,14 +33,10 @@ const TOKEN_FILENAME = 'gemini-cli-workspace-token.json';
|
|
|
31
33
|
const MASTER_KEY_FILENAME = '.gemini-cli-workspace-master-key';
|
|
32
34
|
const MAIN_ACCOUNT_KEY = 'main-account';
|
|
33
35
|
const SALT_SUFFIX = '-gemini-cli-workspace';
|
|
34
|
-
const DEFAULT_CLOUD_FUNCTION_URL = 'https://google-workspace-extension.geminicli.com';
|
|
35
|
-
const DEFAULT_REFRESH_PATH = '/refreshToken';
|
|
36
|
-
const DEFAULT_CLIENT_ID = '338689075775-o75k922vn5fdl18qergr96rp8g63e4d7.apps.googleusercontent.com';
|
|
37
36
|
/** Refresh if the current access token expires within this window. */
|
|
38
37
|
const DEFAULT_EXPIRY_BUFFER_MS = 60_000;
|
|
39
38
|
/** Minimum gap between refresh attempts for the same credential. */
|
|
40
39
|
const REFRESH_COOLDOWN_MS = 30_000;
|
|
41
|
-
const USERINFO_ENDPOINT = 'https://www.googleapis.com/oauth2/v3/userinfo';
|
|
42
40
|
// ============================================================================
|
|
43
41
|
// Helper
|
|
44
42
|
// ============================================================================
|
|
@@ -63,9 +61,9 @@ export class GeminiCliWorkspaceHelper {
|
|
|
63
61
|
this.store = store;
|
|
64
62
|
this.extensionPath = config?.extensionPath ?? DEFAULT_EXTENSION_PATH;
|
|
65
63
|
this.cloudFunctionUrl =
|
|
66
|
-
config?.cloudFunctionUrl ??
|
|
67
|
-
this.refreshPath = config?.refreshPath ??
|
|
68
|
-
this.clientId = config?.clientId ??
|
|
64
|
+
config?.cloudFunctionUrl ?? GEMINI_CLI_CLOUD_FUNCTION_URL;
|
|
65
|
+
this.refreshPath = config?.refreshPath ?? GEMINI_CLI_REFRESH_PATH;
|
|
66
|
+
this.clientId = config?.clientId ?? GOOGLE_OAUTH_CLIENT_ID;
|
|
69
67
|
this.expiryBufferMs = config?.expiryBufferMs ?? DEFAULT_EXPIRY_BUFFER_MS;
|
|
70
68
|
this.fetchFn =
|
|
71
69
|
config?.fetch ??
|
|
@@ -118,7 +116,7 @@ export class GeminiCliWorkspaceHelper {
|
|
|
118
116
|
throw new Error(`Extension token is missing accessToken or refreshToken — login may be incomplete.`);
|
|
119
117
|
}
|
|
120
118
|
const scopes = typeof scope === 'string' ? scope.split(' ').filter(Boolean) : [];
|
|
121
|
-
const accountEmail = await this.
|
|
119
|
+
const accountEmail = await fetchGoogleAccountEmail(accessToken, this.fetchFn);
|
|
122
120
|
return {
|
|
123
121
|
type: 'google-oauth',
|
|
124
122
|
accessToken,
|
|
@@ -247,25 +245,6 @@ export class GeminiCliWorkspaceHelper {
|
|
|
247
245
|
decrypted += decipher.final('utf8');
|
|
248
246
|
return decrypted;
|
|
249
247
|
}
|
|
250
|
-
/**
|
|
251
|
-
* Fetch the user's email via Google's userinfo endpoint. Best-effort;
|
|
252
|
-
* returns undefined on failure.
|
|
253
|
-
*/
|
|
254
|
-
async fetchUserEmail(accessToken) {
|
|
255
|
-
try {
|
|
256
|
-
const response = await this.fetchFn(USERINFO_ENDPOINT, {
|
|
257
|
-
method: 'GET',
|
|
258
|
-
headers: { Authorization: `Bearer ${accessToken}` },
|
|
259
|
-
});
|
|
260
|
-
if (!response.ok)
|
|
261
|
-
return undefined;
|
|
262
|
-
const data = (await response.json());
|
|
263
|
-
return data.email;
|
|
264
|
-
}
|
|
265
|
-
catch {
|
|
266
|
-
return undefined;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
248
|
}
|
|
270
249
|
// ============================================================================
|
|
271
250
|
// Test helpers (not exported from public barrel — intended for tests only)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-cli-workspace.helper.js","sourceRoot":"","sources":["../../../../../../../backend/src/services/credential/helpers/gemini-cli-workspace.helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAKL,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"gemini-cli-workspace.helper.js","sourceRoot":"","sources":["../../../../../../../backend/src/services/credential/helpers/gemini-cli-workspace.helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAKL,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,uBAAuB,GAExB,MAAM,yCAAyC,CAAC;AAEjD,+EAA+E;AAC/E,gEAAgE;AAChE,+CAA+C;AAC/C,+EAA+E;AAE/E,MAAM,sBAAsB,GAAG,IAAI,CAAC,IAAI,CACtC,EAAE,CAAC,OAAO,EAAE,EACZ,SAAS,EACT,YAAY,EACZ,kBAAkB,CACnB,CAAC;AACF,MAAM,cAAc,GAAG,iCAAiC,CAAC;AACzD,MAAM,mBAAmB,GAAG,kCAAkC,CAAC;AAC/D,MAAM,gBAAgB,GAAG,cAAc,CAAC;AACxC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C,sEAAsE;AACtE,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,oEAAoE;AACpE,MAAM,mBAAmB,GAAG,MAAM,CAAC;AA8CnC,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAC1B,IAAI,GAAyB,sBAAsB,CAAC;IAE5C,aAAa,CAAS;IACtB,gBAAgB,CAAS;IACzB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C9C,SAAiB,EACjB,GAAW;IAEX,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAC7D,IAAI,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACxD,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACpC,OAAO,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,SAAS,CAAC;AAC9E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,SAAiB;IAC5D,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,GAAG,WAAW,EAAE,CAAC;IACxE,OAAO,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -64,10 +64,12 @@ export interface CrewlyMcpServerConfig {
|
|
|
64
64
|
*/
|
|
65
65
|
export declare class CrewlyMcpServer {
|
|
66
66
|
private server;
|
|
67
|
-
private storage;
|
|
68
|
-
private memory;
|
|
67
|
+
private readonly storage;
|
|
68
|
+
private readonly memory;
|
|
69
69
|
private transport;
|
|
70
70
|
private stdioTransportCtor;
|
|
71
|
+
private geminiCliHelper;
|
|
72
|
+
private getGeminiCliHelper;
|
|
71
73
|
/**
|
|
72
74
|
* Creates a new CrewlyMcpServer instance.
|
|
73
75
|
*
|
|
@@ -78,6 +80,14 @@ export declare class CrewlyMcpServer {
|
|
|
78
80
|
* Register MCP request handlers for tool listing and tool calling.
|
|
79
81
|
*/
|
|
80
82
|
private registerHandlers;
|
|
83
|
+
/**
|
|
84
|
+
* Build the Server + transport + handlers from already-loaded SDK modules.
|
|
85
|
+
* Returns false if any expected SDK symbol is missing (so the caller can
|
|
86
|
+
* decide whether to throw or silently fall back). Both `ensureInitialized`
|
|
87
|
+
* (dynamic import) and `tryInitializeWithRequire` (CommonJS require) feed
|
|
88
|
+
* their loaded modules through here.
|
|
89
|
+
*/
|
|
90
|
+
private installSdkModules;
|
|
81
91
|
private ensureInitialized;
|
|
82
92
|
private tryInitializeWithRequire;
|
|
83
93
|
/**
|
|
@@ -88,6 +98,14 @@ export declare class CrewlyMcpServer {
|
|
|
88
98
|
* @returns Tool result with content blocks
|
|
89
99
|
*/
|
|
90
100
|
private handleToolCall;
|
|
101
|
+
/**
|
|
102
|
+
* Format a TeamMember for an MCP response. Three variants share the
|
|
103
|
+
* same base (id/name/role/agentStatus/workingStatus); `includeRuntime`
|
|
104
|
+
* adds `runtimeType` + `sessionName`, and `includeTickets` adds
|
|
105
|
+
* `currentTickets`. Keeping all three paths in one place so that a
|
|
106
|
+
* field added to the member shape only needs to be surfaced once.
|
|
107
|
+
*/
|
|
108
|
+
private formatMember;
|
|
91
109
|
/**
|
|
92
110
|
* Handle crewly_get_teams: list all teams and their members.
|
|
93
111
|
*
|
|
@@ -134,6 +152,32 @@ export declare class CrewlyMcpServer {
|
|
|
134
152
|
* @returns Confirmation with message ID
|
|
135
153
|
*/
|
|
136
154
|
private handleSendMessage;
|
|
155
|
+
/**
|
|
156
|
+
* Handle crewly_credential_list: return credential metadata (no values).
|
|
157
|
+
*/
|
|
158
|
+
private handleCredentialList;
|
|
159
|
+
/**
|
|
160
|
+
* Handle crewly_credential_add_api_key: store an API key.
|
|
161
|
+
*/
|
|
162
|
+
private handleCredentialAddApiKey;
|
|
163
|
+
/**
|
|
164
|
+
* Handle crewly_credential_oauth_import_gemini_cli: capture the current
|
|
165
|
+
* gemini-cli-workspace extension login into an encrypted Crewly credential.
|
|
166
|
+
*/
|
|
167
|
+
private handleCredentialImportGeminiCli;
|
|
168
|
+
/**
|
|
169
|
+
* Handle crewly_credential_clear_gemini_cli_file: delete the extension's
|
|
170
|
+
* cached token file so the next extension login captures a fresh account.
|
|
171
|
+
*/
|
|
172
|
+
private handleCredentialClearGeminiCliFile;
|
|
173
|
+
/**
|
|
174
|
+
* Handle crewly_credential_delete: remove a credential.
|
|
175
|
+
*/
|
|
176
|
+
private handleCredentialDelete;
|
|
177
|
+
/**
|
|
178
|
+
* Handle crewly_execute_skill: run a skill with optional credential bindings.
|
|
179
|
+
*/
|
|
180
|
+
private handleExecuteSkill;
|
|
137
181
|
/**
|
|
138
182
|
* Create a success result with JSON-serialized content.
|
|
139
183
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../../../backend/src/services/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../../../backend/src/services/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAcH;;GAEG;AACH,eAAO,MAAM,oBAAoB;IAC/B,sDAAsD;;;;;IAKtD,uCAAuC;;CAE/B,CAAC;AAIX;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAeD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,kBAAkB,CAAgC;IAC1D,OAAO,CAAC,eAAe,CAAyC;IAEhE,OAAO,CAAC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