Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/routes_external.py +120 -10
- platform/core/external_oauth.py +5 -2
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
- web/src/index.css +27 -0
- web/src/settings/ExternalAccessPane.tsx +51 -16
RELEASES.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v75",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "91baf64 (91baf64)",
|
| 3 |
"releases": [
|
| 4 |
{
|
| 5 |
"version": "v75",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
91baf64 (91baf64)
|
api/routes_external.py
CHANGED
|
@@ -10,7 +10,7 @@ import inspect
|
|
| 10 |
import json
|
| 11 |
import time
|
| 12 |
import uuid
|
| 13 |
-
from urllib.parse import parse_qs, quote, urlencode, urlsplit, urlunsplit
|
| 14 |
|
| 15 |
from fastapi import APIRouter, Body, Depends, Header, HTTPException, Request, Response
|
| 16 |
from fastapi.responses import JSONResponse, RedirectResponse
|
|
@@ -725,9 +725,24 @@ def _resolve_external_scope(
|
|
| 725 |
}
|
| 726 |
if include_schema:
|
| 727 |
if row["answerable"] or strict_schema:
|
| 728 |
-
|
| 729 |
-
|
| 730 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 731 |
row["schema"] = {
|
| 732 |
key: value for key, value in scoped.items()
|
| 733 |
if key not in {"records", "filters"}
|
|
@@ -804,6 +819,16 @@ def _portable_skill_document(session: Session | None, base_url: str) -> str:
|
|
| 804 |
"as the key's maker with the maker's own grants. It applies the same database, "
|
| 805 |
"field, row and workbook permissions as the Loopable app."),
|
| 806 |
"",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 807 |
"## Authentication",
|
| 808 |
"",
|
| 809 |
"```http",
|
|
@@ -1566,9 +1591,21 @@ def _oauth_token_error(code: str):
|
|
| 1566 |
@router.post("/oauth/token")
|
| 1567 |
async def oauth_token(request: Request):
|
| 1568 |
"""Cookie-free authorization-code exchange and rotating refresh-token endpoint."""
|
|
|
|
| 1569 |
try:
|
| 1570 |
body = await _oauth_token_body(request)
|
| 1571 |
grant_type = body.get("grant_type")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1572 |
audience = _require_oauth_resource(request, body.get("resource"))
|
| 1573 |
if grant_type == "authorization_code":
|
| 1574 |
result = external_oauth.exchange_code(
|
|
@@ -1592,6 +1629,9 @@ async def oauth_token(request: Request):
|
|
| 1592 |
else:
|
| 1593 |
raise external_oauth.ExternalOAuthError("oauth_request_invalid")
|
| 1594 |
except external_access.ExternalAccessError as exc:
|
|
|
|
|
|
|
|
|
|
| 1595 |
return _oauth_token_error(exc.code)
|
| 1596 |
response = JSONResponse(result)
|
| 1597 |
response.headers.update({"Cache-Control": "no-store", "Pragma": "no-cache"})
|
|
@@ -2972,7 +3012,75 @@ def _mcp_content(rid, out):
|
|
| 2972 |
"content": [{"type": "text", "text": encoded}], "isError": not out.get("ok", False)}}
|
| 2973 |
|
| 2974 |
|
| 2975 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2976 |
"""One HTTP request object; the stdio precedent's JSON-RPC and content envelopes."""
|
| 2977 |
def protocol_error(rid, code, message):
|
| 2978 |
return {"jsonrpc": "2.0", "id": rid, "error": {"code": code, "message": message}}
|
|
@@ -3001,15 +3109,17 @@ def _handle_mcp(req, session: Session):
|
|
| 3001 |
return protocol_error(rid, -32602, "The protocol version must be a safe string.")
|
| 3002 |
return {"jsonrpc": "2.0", "id": rid, "result": {
|
| 3003 |
"protocolVersion": protocol, "capabilities": {"tools": {}},
|
| 3004 |
-
"serverInfo": {"name": "loopable-external", "version": "1.0.0"}
|
|
|
|
| 3005 |
if method == "ping":
|
| 3006 |
return {"jsonrpc": "2.0", "id": rid, "result": {}}
|
| 3007 |
if method == "tools/list":
|
| 3008 |
-
return {"jsonrpc": "2.0", "id": rid, "result": {"tools":
|
| 3009 |
-
{"name": key, "description": tool["description"], "inputSchema": tool["inputSchema"]}
|
| 3010 |
-
for key, tool in external_tools.TOOLS.items()]}}
|
| 3011 |
if method != "tools/call":
|
| 3012 |
return protocol_error(rid, -32601, "The requested MCP method was not found.")
|
|
|
|
|
|
|
|
|
|
| 3013 |
arguments = params.get("arguments", {})
|
| 3014 |
for database in _databases_in_arguments(arguments):
|
| 3015 |
_assert_database_scope(session, database)
|
|
@@ -3059,7 +3169,7 @@ async def external_mcp(request: Request, session: Session = Depends(require_exte
|
|
| 3059 |
except (ValueError, UnicodeError):
|
| 3060 |
return {"jsonrpc": "2.0", "id": None,
|
| 3061 |
"error": {"code": -32700, "message": "The request body must be valid JSON."}}
|
| 3062 |
-
reply = await run_in_threadpool(_handle_mcp, req, session)
|
| 3063 |
return Response(status_code=204) if reply is None else reply
|
| 3064 |
|
| 3065 |
|
|
|
|
| 10 |
import json
|
| 11 |
import time
|
| 12 |
import uuid
|
| 13 |
+
from urllib.parse import parse_qs, quote, unquote, urlencode, urlsplit, urlunsplit
|
| 14 |
|
| 15 |
from fastapi import APIRouter, Body, Depends, Header, HTTPException, Request, Response
|
| 16 |
from fastapi.responses import JSONResponse, RedirectResponse
|
|
|
|
| 725 |
}
|
| 726 |
if include_schema:
|
| 727 |
if row["answerable"] or strict_schema:
|
| 728 |
+
try:
|
| 729 |
+
scoped = deps.assistant_read_scope(
|
| 730 |
+
session, database, fields=None, filters=None,
|
| 731 |
+
)
|
| 732 |
+
except HTTPException as exc:
|
| 733 |
+
# HOTFIX 2026-09-24: ONE refusing source (measured: a 996,203-row mirror
|
| 734 |
+
# past the Assistant's one-pass read) failed the WHOLE skill.md and the
|
| 735 |
+
# `loopable_guide` with it. Non-strict, it is listed with its reason;
|
| 736 |
+
# the strict schema route still raises exactly as before.
|
| 737 |
+
if strict_schema:
|
| 738 |
+
raise
|
| 739 |
+
info = exc.detail.get("error", {}) if isinstance(exc.detail, dict) else {}
|
| 740 |
+
row["answerable"] = False
|
| 741 |
+
row["reason"] = str(info.get("message") or "This database cannot be described right now.")
|
| 742 |
+
row["label"] = fallback_label(database)
|
| 743 |
+
row["fields"] = []
|
| 744 |
+
resolved.append(row)
|
| 745 |
+
continue
|
| 746 |
row["schema"] = {
|
| 747 |
key: value for key, value in scoped.items()
|
| 748 |
if key not in {"records", "filters"}
|
|
|
|
| 819 |
"as the key's maker with the maker's own grants. It applies the same database, "
|
| 820 |
"field, row and workbook permissions as the Loopable app."),
|
| 821 |
"",
|
| 822 |
+
# HOTFIX 2026-09-24 (owner: "available for ALL AI API connection so its also skill etc,
|
| 823 |
+
# and always updated"). The SAME rules every MCP client gets on initialize and from
|
| 824 |
+
# `loopable_guide`, read from one constant, so skill.md cannot drift from them.
|
| 825 |
+
"## How to work with Loopable",
|
| 826 |
+
"",
|
| 827 |
+
*MCP_INSTRUCTIONS.split(chr(10)),
|
| 828 |
+
"",
|
| 829 |
+
("Over remote MCP, call `loopable_guide` first. It returns these rules, your databases "
|
| 830 |
+
"and every tool, generated from the running server."),
|
| 831 |
+
"",
|
| 832 |
"## Authentication",
|
| 833 |
"",
|
| 834 |
"```http",
|
|
|
|
| 1591 |
@router.post("/oauth/token")
|
| 1592 |
async def oauth_token(request: Request):
|
| 1593 |
"""Cookie-free authorization-code exchange and rotating refresh-token endpoint."""
|
| 1594 |
+
body: dict = {}
|
| 1595 |
try:
|
| 1596 |
body = await _oauth_token_body(request)
|
| 1597 |
grant_type = body.get("grant_type")
|
| 1598 |
+
# HOTFIX 2026-09-24: ChatGPT's refresh answered 400 on staging while the same refresh
|
| 1599 |
+
# passes here. A client may name itself in HTTP Basic (RFC 6749 2.3.1) rather than the
|
| 1600 |
+
# body; read it from there too. The refresh token stays the credential.
|
| 1601 |
+
if not body.get("client_id"):
|
| 1602 |
+
basic = request.headers.get("authorization", "")
|
| 1603 |
+
if basic[:6].lower() == "basic ":
|
| 1604 |
+
try:
|
| 1605 |
+
decoded = base64.b64decode(basic[6:].strip()).decode("utf-8")
|
| 1606 |
+
body = {**body, "client_id": unquote(decoded.split(":", 1)[0])}
|
| 1607 |
+
except (ValueError, UnicodeError):
|
| 1608 |
+
pass
|
| 1609 |
audience = _require_oauth_resource(request, body.get("resource"))
|
| 1610 |
if grant_type == "authorization_code":
|
| 1611 |
result = external_oauth.exchange_code(
|
|
|
|
| 1629 |
else:
|
| 1630 |
raise external_oauth.ExternalOAuthError("oauth_request_invalid")
|
| 1631 |
except external_access.ExternalAccessError as exc:
|
| 1632 |
+
# Names only: which grant, which refusal and which keys arrived, never a value.
|
| 1633 |
+
print(f"oauth/token refused: grant_type={body.get('grant_type')} code={exc.code} "
|
| 1634 |
+
f"keys={sorted(body)}", flush=True)
|
| 1635 |
return _oauth_token_error(exc.code)
|
| 1636 |
response = JSONResponse(result)
|
| 1637 |
response.headers.update({"Cache-Control": "no-store", "Pragma": "no-cache"})
|
|
|
|
| 3012 |
"content": [{"type": "text", "text": encoded}], "isError": not out.get("ok", False)}}
|
| 3013 |
|
| 3014 |
|
| 3015 |
+
# ⭐⭐ HOTFIX 2026-09-24 — WHAT AN MCP CLIENT IS TOLD, AND WHERE IT READS THE REST. Owner: does
|
| 3016 |
+
# ChatGPT "have access to Loopable skill so it knows best practice in tool calling". It did not:
|
| 3017 |
+
# skill.md is only offered to coding agents, and `initialize` sent no guidance. Two doors, because
|
| 3018 |
+
# clients differ: `instructions` on initialize (the MCP field; Claude reads it) and a read-only
|
| 3019 |
+
# `loopable_guide` tool (every client can call a tool). ⛔ Model-facing text is user-facing copy:
|
| 3020 |
+
# no em or en dashes here.
|
| 3021 |
+
MCP_GUIDE_TOOL = "loopable_guide"
|
| 3022 |
+
MCP_INSTRUCTIONS = "\n".join([
|
| 3023 |
+
"Loopable is a governed business data workspace: databases, saved Views, Sheet workbooks and "
|
| 3024 |
+
"Apps. Every call runs as the signed-in user, with that user's own permissions.",
|
| 3025 |
+
"1. Call loopable_guide once at the start. It returns this user's databases and the rules "
|
| 3026 |
+
"for every tool.",
|
| 3027 |
+
"2. Discover before you query: list_databases, then describe_database for the database you "
|
| 3028 |
+
"need. Use only field keys that describe_database returns; never guess a field name.",
|
| 3029 |
+
"3. Read with query_database. Filter and sort on the server, ask only for the fields you need, "
|
| 3030 |
+
"and follow the cursor for more pages instead of reading everything. Report totals from the "
|
| 3031 |
+
"counts the tool returns, not from the rows you happened to read.",
|
| 3032 |
+
"4. Every write returns a preview first. Show the user what will change and call "
|
| 3033 |
+
"confirm_change only after they agree. A destructive change needs the exact phrase the "
|
| 3034 |
+
"preview names.",
|
| 3035 |
+
"5. A refusal (ok: false) names its code and reason. Tell the user the reason; do not retry "
|
| 3036 |
+
"the same call with a wider scope.",
|
| 3037 |
+
"6. Never ask for, print or store a credential.",
|
| 3038 |
+
])
|
| 3039 |
+
_MCP_GUIDE_SPEC = {
|
| 3040 |
+
"name": MCP_GUIDE_TOOL,
|
| 3041 |
+
"description": ("Read this first. The Loopable guide for this user: their databases and "
|
| 3042 |
+
"the rules for calling every other tool."),
|
| 3043 |
+
"inputSchema": {"type": "object", "properties": {}, "required": [],
|
| 3044 |
+
"additionalProperties": False},
|
| 3045 |
+
"annotations": {"title": "Loopable guide", "readOnlyHint": True, "openWorldHint": False},
|
| 3046 |
+
}
|
| 3047 |
+
|
| 3048 |
+
|
| 3049 |
+
def _mcp_guide(session: Session) -> str:
|
| 3050 |
+
"""`loopable_guide`'s answer: the rules, this user's databases and every tool, in one read.
|
| 3051 |
+
|
| 3052 |
+
⛔ NO ROWS ARE READ. The first version lent the per-user skill.md, which reads EVERY database
|
| 3053 |
+
through the Assistant path to list its fields: measured on staging at 52 s and 57 KB, too
|
| 3054 |
+
slow for a tool whose whole job is to be called first. Fields are one describe_database call
|
| 3055 |
+
away, for the one database the question is about.
|
| 3056 |
+
"""
|
| 3057 |
+
lines = ["# Loopable guide", "", f"Signed in as {session.uname}.", "", MCP_INSTRUCTIONS, "",
|
| 3058 |
+
"## Your databases", "",
|
| 3059 |
+
"Call describe_database with a key below for its fields before you query it.", ""]
|
| 3060 |
+
rows = [row for row in _resolve_external_scope(session) if row["permitted"]]
|
| 3061 |
+
for row in rows:
|
| 3062 |
+
note = "" if row["answerable"] else f" Not queryable right now: {_markdown_inline(row['reason'])}"
|
| 3063 |
+
lines.append(f"- `{row['database']}`: {_markdown_inline(row['label'])}.{note}")
|
| 3064 |
+
if not rows:
|
| 3065 |
+
lines.append("- No databases are available to this account.")
|
| 3066 |
+
lines += ["", "## Tools", ""]
|
| 3067 |
+
for key, tool in external_tools.TOOLS.items():
|
| 3068 |
+
kind = "writes, preview then confirm_change" if tool["write"] else "read only"
|
| 3069 |
+
lines.append(f"- `{key}` ({kind}): {_markdown_inline(tool['description'])}")
|
| 3070 |
+
return chr(10).join(lines) + chr(10)
|
| 3071 |
+
|
| 3072 |
+
|
| 3073 |
+
def _mcp_tool_specs() -> list[dict]:
|
| 3074 |
+
"""tools/list: the guide first, then the registry, each with its read or write hint."""
|
| 3075 |
+
specs = [_MCP_GUIDE_SPEC]
|
| 3076 |
+
for key, tool in external_tools.TOOLS.items():
|
| 3077 |
+
specs.append({"name": key, "description": tool["description"],
|
| 3078 |
+
"inputSchema": tool["inputSchema"],
|
| 3079 |
+
"annotations": {"readOnlyHint": not tool["write"], "openWorldHint": False}})
|
| 3080 |
+
return specs
|
| 3081 |
+
|
| 3082 |
+
|
| 3083 |
+
def _handle_mcp(req, session: Session, base_url: str = ""):
|
| 3084 |
"""One HTTP request object; the stdio precedent's JSON-RPC and content envelopes."""
|
| 3085 |
def protocol_error(rid, code, message):
|
| 3086 |
return {"jsonrpc": "2.0", "id": rid, "error": {"code": code, "message": message}}
|
|
|
|
| 3109 |
return protocol_error(rid, -32602, "The protocol version must be a safe string.")
|
| 3110 |
return {"jsonrpc": "2.0", "id": rid, "result": {
|
| 3111 |
"protocolVersion": protocol, "capabilities": {"tools": {}},
|
| 3112 |
+
"serverInfo": {"name": "loopable-external", "version": "1.0.0"},
|
| 3113 |
+
"instructions": MCP_INSTRUCTIONS}}
|
| 3114 |
if method == "ping":
|
| 3115 |
return {"jsonrpc": "2.0", "id": rid, "result": {}}
|
| 3116 |
if method == "tools/list":
|
| 3117 |
+
return {"jsonrpc": "2.0", "id": rid, "result": {"tools": _mcp_tool_specs()}}
|
|
|
|
|
|
|
| 3118 |
if method != "tools/call":
|
| 3119 |
return protocol_error(rid, -32601, "The requested MCP method was not found.")
|
| 3120 |
+
if name == MCP_GUIDE_TOOL:
|
| 3121 |
+
return _mcp_content(rid, {"ok": True, "data": {
|
| 3122 |
+
"instructions": MCP_INSTRUCTIONS, "guide": _mcp_guide(session)}})
|
| 3123 |
arguments = params.get("arguments", {})
|
| 3124 |
for database in _databases_in_arguments(arguments):
|
| 3125 |
_assert_database_scope(session, database)
|
|
|
|
| 3169 |
except (ValueError, UnicodeError):
|
| 3170 |
return {"jsonrpc": "2.0", "id": None,
|
| 3171 |
"error": {"code": -32700, "message": "The request body must be valid JSON."}}
|
| 3172 |
+
reply = await run_in_threadpool(_handle_mcp, req, session, str(request.base_url))
|
| 3173 |
return Response(status_code=204) if reply is None else reply
|
| 3174 |
|
| 3175 |
|
platform/core/external_oauth.py
CHANGED
|
@@ -545,10 +545,13 @@ def refresh(refresh_token, *, client_id, resource, runtime_resolver, now=None) -
|
|
| 545 |
book["grants"] = grants
|
| 546 |
result["error"] = "oauth_refresh_replayed"
|
| 547 |
return book
|
| 548 |
-
client
|
|
|
|
|
|
|
|
|
|
| 549 |
if (not current_ok or not current_match or not isinstance(row, dict)
|
| 550 |
or row.get("disconnected_at") or row.get("tenant") != tenant_key
|
| 551 |
-
or row.get("client_id") !=
|
| 552 |
or row.get("resource") != audience
|
| 553 |
or float(row.get("refresh_expires_at") or 0) < issued_at
|
| 554 |
or not isinstance(client, dict) or client.get("revoked_at")
|
|
|
|
| 545 |
book["grants"] = grants
|
| 546 |
result["error"] = "oauth_refresh_replayed"
|
| 547 |
return book
|
| 548 |
+
# HOTFIX 2026-09-24: a public client that omits client_id on refresh is the client the
|
| 549 |
+
# grant was issued to; the refresh token, matched below, is the credential.
|
| 550 |
+
named = client_id or (row.get("client_id") if isinstance(row, dict) else None)
|
| 551 |
+
client = book["clients"].get(named)
|
| 552 |
if (not current_ok or not current_match or not isinstance(row, dict)
|
| 553 |
or row.get("disconnected_at") or row.get("tenant") != tenant_key
|
| 554 |
+
or row.get("client_id") != named
|
| 555 |
or row.get("resource") != audience
|
| 556 |
or float(row.get("refresh_expires_at") or 0) < issued_at
|
| 557 |
or not isinstance(client, dict) or client.get("revoked_at")
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
8e8f73bacdb3600d495ec32e74298e1436d38d7d864d4a68cf0fe58bcfb8e2c5
|
web/src/index.css
CHANGED
|
@@ -13941,3 +13941,30 @@ input.conn-odoo-v:disabled { background: var(--lp-surface-2); color: var(--lp-mu
|
|
| 13941 |
.cg-overlay.sheet-ribbon-view {
|
| 13942 |
overflow-y: auto;
|
| 13943 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13941 |
.cg-overlay.sheet-ribbon-view {
|
| 13942 |
overflow-y: auto;
|
| 13943 |
}
|
| 13944 |
+
|
| 13945 |
+
|
| 13946 |
+
/* HOTFIX 2026-09-24 — AI API: the AI connections list wears the Data grid's look (owner: "make it
|
| 13947 |
+
look like a Grid view"). Values mirror `customer-grid/theme.ts::lightTheme`: washed header in
|
| 13948 |
+
600 weight ink, --lp-fs-xs cells, 1px --lp-line hairlines, muted row numbers, a status bubble. */
|
| 13949 |
+
.ea-grid { overflow-x: auto; margin-top: 12px; border: 1px solid var(--lp-line); border-radius: 8px;
|
| 13950 |
+
background: var(--lp-surface); }
|
| 13951 |
+
.ea-grid-table { width: 100%; border-collapse: collapse; font-size: var(--lp-fs-xs); color: var(--lp-ink); }
|
| 13952 |
+
.ea-grid-table th, .ea-grid-table td { height: 34px; padding: 0 8px; text-align: left; white-space: nowrap;
|
| 13953 |
+
border-right: 1px solid var(--lp-line); border-bottom: 1px solid var(--lp-line); }
|
| 13954 |
+
.ea-grid-table th:last-child, .ea-grid-table td:last-child { border-right: 0; }
|
| 13955 |
+
.ea-grid-table tbody tr:last-child td { border-bottom: 0; }
|
| 13956 |
+
.ea-grid-table th { background: #fafbfc; font-weight: 600; }
|
| 13957 |
+
.ea-grid-table tbody tr:hover td { background: #f6f7f9; }
|
| 13958 |
+
.ea-grid-num { width: 36px; text-align: center !important; color: var(--lp-muted); font-size: var(--lp-fs-3xs);
|
| 13959 |
+
font-variant-numeric: tabular-nums; }
|
| 13960 |
+
.ea-grid-act { width: 1%; text-align: right !important; }
|
| 13961 |
+
.ea-grid-app { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
|
| 13962 |
+
.ea-grid-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: var(--lp-fs-2xs); line-height: 18px;
|
| 13963 |
+
background: var(--lp-line); color: var(--lp-ink); }
|
| 13964 |
+
.ea-grid-pill.is-connected { background: #ebf6ef; color: #35754e; }
|
| 13965 |
+
.ea-grid-pill.is-expired { background: #fbf4e0; color: #7e6428; }
|
| 13966 |
+
.ea-grid-btn { font: inherit; font-size: var(--lp-fs-2xs); padding: 3px 10px; border-radius: 6px; cursor: pointer;
|
| 13967 |
+
border: 1px solid var(--lp-line); background: var(--lp-surface); color: #a3453c; }
|
| 13968 |
+
.ea-grid-btn:hover:not(:disabled) { background: #fceeec; border-color: #f3d6d2; }
|
| 13969 |
+
.ea-grid-btn:disabled { opacity: .5; cursor: default; }
|
| 13970 |
+
.ea-grid-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
web/src/settings/ExternalAccessPane.tsx
CHANGED
|
@@ -129,6 +129,8 @@ interface ExternalConnection {
|
|
| 129 |
last_used: string | null;
|
| 130 |
expires_at: string | null;
|
| 131 |
disconnected_at: string | null;
|
|
|
|
|
|
|
| 132 |
}
|
| 133 |
|
| 134 |
interface KeyListResponse { keys: ExternalKeyMetadata[]; can_mint: boolean }
|
|
@@ -235,6 +237,10 @@ function parseConnection(value: unknown): ExternalConnection | null {
|
|
| 235 |
last_used: typeof row.last_used === "string" ? row.last_used : null,
|
| 236 |
expires_at,
|
| 237 |
disconnected_at,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
};
|
| 239 |
}
|
| 240 |
|
|
@@ -1084,24 +1090,53 @@ export default function ExternalAccessPane() {
|
|
| 1084 |
{revealCard}
|
| 1085 |
|
| 1086 |
{connections.length > 0 ? (
|
|
|
|
|
|
|
|
|
|
| 1087 |
<section className="set-card">
|
| 1088 |
<h2 className="set-h4">AI connections</h2>
|
| 1089 |
-
|
| 1090 |
-
<
|
| 1091 |
-
<
|
| 1092 |
-
<
|
| 1093 |
-
|
| 1094 |
-
|
| 1095 |
-
|
| 1096 |
-
|
| 1097 |
-
<
|
| 1098 |
-
|
| 1099 |
-
|
| 1100 |
-
</
|
| 1101 |
-
</
|
| 1102 |
-
|
| 1103 |
-
|
| 1104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1105 |
</section>
|
| 1106 |
) : null}
|
| 1107 |
|
|
|
|
| 129 |
last_used: string | null;
|
| 130 |
expires_at: string | null;
|
| 131 |
disconnected_at: string | null;
|
| 132 |
+
access: Access | null;
|
| 133 |
+
databases: ResourceScope | null;
|
| 134 |
}
|
| 135 |
|
| 136 |
interface KeyListResponse { keys: ExternalKeyMetadata[]; can_mint: boolean }
|
|
|
|
| 237 |
last_used: typeof row.last_used === "string" ? row.last_used : null,
|
| 238 |
expires_at,
|
| 239 |
disconnected_at,
|
| 240 |
+
access: row.access === "read" || row.access === "readwrite" ? row.access : null,
|
| 241 |
+
databases: row.databases === "all" ? "all"
|
| 242 |
+
: Array.isArray(row.databases) ? row.databases.filter((item): item is string => typeof item === "string")
|
| 243 |
+
: null,
|
| 244 |
};
|
| 245 |
}
|
| 246 |
|
|
|
|
| 1090 |
{revealCard}
|
| 1091 |
|
| 1092 |
{connections.length > 0 ? (
|
| 1093 |
+
/* HOTFIX 2026-09-24 (owner: the AI connections list "is really ugly, let's make it look
|
| 1094 |
+
like a Grid view"). One row per connection in the Data grid's own look: row numbers,
|
| 1095 |
+
a washed header, hairline cells and a status pill (`index.css` `.ea-grid`). */
|
| 1096 |
<section className="set-card">
|
| 1097 |
<h2 className="set-h4">AI connections</h2>
|
| 1098 |
+
<div className="ea-grid" role="region" aria-label="AI connections" tabIndex={0}>
|
| 1099 |
+
<table className="ea-grid-table">
|
| 1100 |
+
<thead>
|
| 1101 |
+
<tr>
|
| 1102 |
+
<th scope="col" className="ea-grid-num"><span className="ea-grid-sr">Row</span></th>
|
| 1103 |
+
<th scope="col">AI app</th>
|
| 1104 |
+
<th scope="col">Status</th>
|
| 1105 |
+
<th scope="col">Access</th>
|
| 1106 |
+
<th scope="col">Databases</th>
|
| 1107 |
+
<th scope="col">Connected</th>
|
| 1108 |
+
<th scope="col">Last used</th>
|
| 1109 |
+
<th scope="col" className="ea-grid-act"><span className="ea-grid-sr">Actions</span></th>
|
| 1110 |
+
</tr>
|
| 1111 |
+
</thead>
|
| 1112 |
+
<tbody>
|
| 1113 |
+
{connections.map((connection, index) => (
|
| 1114 |
+
<tr key={connection.id}>
|
| 1115 |
+
<td className="ea-grid-num">{index + 1}</td>
|
| 1116 |
+
<td>
|
| 1117 |
+
<span className="ea-grid-app">
|
| 1118 |
+
{connection.clientId ? <AiClientMark id={connection.clientId} size={16} /> : null}
|
| 1119 |
+
<span>{connection.label || "Unnamed AI app"}</span>
|
| 1120 |
+
</span>
|
| 1121 |
+
</td>
|
| 1122 |
+
<td><span className={`ea-grid-pill is-${connection.status}`}>{connectionLabel(connection)}</span></td>
|
| 1123 |
+
<td>{connection.access === null ? "" : connection.access === "read" ? "Read only" : "Read and write"}</td>
|
| 1124 |
+
<td>{connection.databases === null ? "" : databaseLabels(connection.databases)}</td>
|
| 1125 |
+
<td>{when(connection.created)}</td>
|
| 1126 |
+
<td>{when(connection.last_used)}</td>
|
| 1127 |
+
<td className="ea-grid-act">
|
| 1128 |
+
{connection.status === "connected" ? (
|
| 1129 |
+
<button type="button" className="ea-grid-btn" disabled={busy !== ""}
|
| 1130 |
+
onClick={() => void disconnect(connection)}>
|
| 1131 |
+
{busy === `disconnect:${connection.client}` ? "Disconnecting…" : "Disconnect"}
|
| 1132 |
+
</button>
|
| 1133 |
+
) : null}
|
| 1134 |
+
</td>
|
| 1135 |
+
</tr>
|
| 1136 |
+
))}
|
| 1137 |
+
</tbody>
|
| 1138 |
+
</table>
|
| 1139 |
+
</div>
|
| 1140 |
</section>
|
| 1141 |
) : null}
|
| 1142 |
|