Merge branch 'taylorwilsdon:main' into feat/tasks-manage-permission
This commit is contained in:
@@ -28,6 +28,7 @@ from auth.scopes import (
|
|||||||
GMAIL_MODIFY_SCOPE,
|
GMAIL_MODIFY_SCOPE,
|
||||||
GMAIL_LABELS_SCOPE,
|
GMAIL_LABELS_SCOPE,
|
||||||
GMAIL_SETTINGS_BASIC_SCOPE,
|
GMAIL_SETTINGS_BASIC_SCOPE,
|
||||||
|
DRIVE_SCOPE,
|
||||||
DRIVE_READONLY_SCOPE,
|
DRIVE_READONLY_SCOPE,
|
||||||
DRIVE_FILE_SCOPE,
|
DRIVE_FILE_SCOPE,
|
||||||
DOCS_READONLY_SCOPE,
|
DOCS_READONLY_SCOPE,
|
||||||
@@ -426,6 +427,7 @@ SCOPE_GROUPS = {
|
|||||||
"gmail_labels": GMAIL_LABELS_SCOPE,
|
"gmail_labels": GMAIL_LABELS_SCOPE,
|
||||||
"gmail_settings_basic": GMAIL_SETTINGS_BASIC_SCOPE,
|
"gmail_settings_basic": GMAIL_SETTINGS_BASIC_SCOPE,
|
||||||
# Drive scopes
|
# Drive scopes
|
||||||
|
"drive": DRIVE_SCOPE,
|
||||||
"drive_read": DRIVE_READONLY_SCOPE,
|
"drive_read": DRIVE_READONLY_SCOPE,
|
||||||
"drive_file": DRIVE_FILE_SCOPE,
|
"drive_file": DRIVE_FILE_SCOPE,
|
||||||
# Docs scopes
|
# Docs scopes
|
||||||
|
|||||||
@@ -26,24 +26,30 @@ LIST_TASKS_MAX_POSITION = "99999999999999999999"
|
|||||||
|
|
||||||
|
|
||||||
def _format_reauth_message(error: Exception, user_google_email: str) -> str:
|
def _format_reauth_message(error: Exception, user_google_email: str) -> str:
|
||||||
base = f"API error: {error}. You might need to re-authenticate."
|
base = f"API error: {error}"
|
||||||
if is_oauth21_enabled():
|
|
||||||
if is_external_oauth21_provider():
|
# Only suggest re-authentication for auth-related errors (401, 403)
|
||||||
hint = (
|
if isinstance(error, HttpError) and error.resp.status in (401, 403):
|
||||||
"LLM: Ask the user to provide a valid OAuth 2.1 bearer token in the "
|
base += ". You might need to re-authenticate."
|
||||||
"Authorization header and retry."
|
if is_oauth21_enabled():
|
||||||
)
|
if is_external_oauth21_provider():
|
||||||
|
hint = (
|
||||||
|
"LLM: Ask the user to provide a valid OAuth 2.1 bearer token in the "
|
||||||
|
"Authorization header and retry."
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
hint = (
|
||||||
|
"LLM: Ask the user to authenticate via their MCP client's OAuth 2.1 "
|
||||||
|
"flow and retry."
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
hint = (
|
hint = (
|
||||||
"LLM: Ask the user to authenticate via their MCP client's OAuth 2.1 "
|
"LLM: Try 'start_google_auth' with the user's email "
|
||||||
"flow and retry."
|
f"({user_google_email}) and service_name='Google Tasks'."
|
||||||
)
|
)
|
||||||
else:
|
return f"{base} {hint}"
|
||||||
hint = (
|
|
||||||
"LLM: Try 'start_google_auth' with the user's email "
|
return base
|
||||||
f"({user_google_email}) and service_name='Google Tasks'."
|
|
||||||
)
|
|
||||||
return f"{base} {hint}"
|
|
||||||
|
|
||||||
|
|
||||||
class StructuredTask:
|
class StructuredTask:
|
||||||
|
|||||||
Reference in New Issue
Block a user