Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/routes_query.py +36 -1
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "f818505758",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
f818505758
|
api/routes_query.py
CHANGED
|
@@ -124,6 +124,18 @@ QUERY_NO_SOURCE_MATCHED = (
|
|
| 124 |
"None of the databases you can read cover that question. Pick one from the list, "
|
| 125 |
"or ask about a database you can open."
|
| 126 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
QUERY_DRAFT_ADMIN = "This database has no approved fields yet. Pick the ones this answer should use and they will be approved for everyone."
|
| 128 |
QUERY_DRAFT_MEMBER = "This database has no approved fields yet. Pick the ones you need and your administrators will be asked to approve them."
|
| 129 |
QUERY_DRAFT_SENT = "Sent to your administrators. Ask again once one of them approves."
|
|
@@ -1023,6 +1035,8 @@ def _call_model(question, snapshot, model=MODEL_AUTO, chat=None, history=None, s
|
|
| 1023 |
tools.extend(agent_runtime.tool_specs(session, snapshot=snapshot))
|
| 1024 |
if turn.get("openWork"):
|
| 1025 |
tools = [tool for tool in tools if tool["function"]["name"] == "open_items"]
|
|
|
|
|
|
|
| 1026 |
if turn.get("admittedTools"):
|
| 1027 |
tools = [tool for tool in tools if tool["function"]["name"] in set(turn["admittedTools"])]
|
| 1028 |
if turn.get("memoryOnly"):
|
|
@@ -1033,6 +1047,8 @@ def _call_model(question, snapshot, model=MODEL_AUTO, chat=None, history=None, s
|
|
| 1033 |
"You are the Loopable Assistant. Use tools for facts. Writes run at once. Deletes need the user's yes.")
|
| 1034 |
if turn.get("context"):
|
| 1035 |
prompt += "\n\n" + turn["context"]
|
|
|
|
|
|
|
| 1036 |
if turn.get("toolShareRequests"):
|
| 1037 |
prompt += ("\nThis turn concerns a pending tool-share approval only. Use the prior conversation to identify "
|
| 1038 |
"the request. Ask which request when the user's approval is ambiguous. "
|
|
@@ -2013,8 +2029,13 @@ def _submit_active(body, session, question, selected_model, context_hint, dock,
|
|
| 2013 |
memory_only = dock is None and not target and replay is None and assistant_memory.admits(question)
|
| 2014 |
routed = _route(session, question) if dock is None and not open_work and not admitted and not memory_only and not share_requests and not agent_runtime.has_attachments() and not target and replay is None else {
|
| 2015 |
"database": target, "auto": False, "alternatives": []}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2016 |
target = routed["database"]
|
| 2017 |
-
route_refusal = (None if dock is not None or open_work or admitted or memory_only or share_requests or agent_runtime.has_attachments() else
|
| 2018 |
QUERY_NO_SOURCE_MATCHED if not target and replay is None else routed.get("refusal"))
|
| 2019 |
|
| 2020 |
# Snapshot turns plan mirrors from schema. Dock turns read through permissioned tools.
|
|
@@ -2064,6 +2085,8 @@ def _submit_active(body, session, question, selected_model, context_hint, dock,
|
|
| 2064 |
turn["admittedTools"] = sorted(admitted)
|
| 2065 |
if memory_only:
|
| 2066 |
turn["memoryOnly"] = True
|
|
|
|
|
|
|
| 2067 |
turn["memoryCompanyRequested"] = assistant_memory.company_requested(question)
|
| 2068 |
if snapshot is not None:
|
| 2069 |
turn["memorySources"] = [{"database": snapshot["database"],
|
|
@@ -2744,6 +2767,14 @@ def _route_candidates(session):
|
|
| 2744 |
return candidates
|
| 2745 |
|
| 2746 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2747 |
def _route(session, question):
|
| 2748 |
from harness import semantic as sem
|
| 2749 |
candidates = _route_candidates(session)
|
|
@@ -3310,6 +3341,10 @@ def governed_query(body: dict = Body(default=None),
|
|
| 3310 |
"database": "", "label": "", "reason": "", "auto": False, "alternatives": []}}
|
| 3311 |
routed = _route(session, question) if not database else {
|
| 3312 |
"database": database, "label": "", "reason": "", "auto": False, "alternatives": []}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3313 |
database = routed["database"]
|
| 3314 |
if database:
|
| 3315 |
_semantic_authorize(session, database, require_answerable=not routed["auto"])
|
|
|
|
| 124 |
"None of the databases you can read cover that question. Pick one from the list, "
|
| 125 |
"or ask about a database you can open."
|
| 126 |
)
|
| 127 |
+
# A fresh turn made only of these words names no data subject, so it is conversation (D-2673).
|
| 128 |
+
_CHAT_WORDS = (
|
| 129 |
+
"hello hi hey hiya good morning afternoon evening thanks thank please ok okay yes no yeah yep sure "
|
| 130 |
+
"cool great nice sorry bye goodbye cheers welcome i me you your yours we it its they them can could "
|
| 131 |
+
"would will should might have has had be am been being does doing done get got there here then "
|
| 132 |
+
"just also too so really still now hear see know help think say ask mean understand need want like "
|
| 133 |
+
"try talk chat explain database table field data workspace loopable assistant loopy app question answer"
|
| 134 |
+
)
|
| 135 |
+
CONVERSATION_PROMPT = (
|
| 136 |
+
"\nNo database is chosen for this turn and no tool is available. Reply in plain words and never "
|
| 137 |
+
"state a figure from data. If the user asks about their data, ask which database to use."
|
| 138 |
+
)
|
| 139 |
QUERY_DRAFT_ADMIN = "This database has no approved fields yet. Pick the ones this answer should use and they will be approved for everyone."
|
| 140 |
QUERY_DRAFT_MEMBER = "This database has no approved fields yet. Pick the ones you need and your administrators will be asked to approve them."
|
| 141 |
QUERY_DRAFT_SENT = "Sent to your administrators. Ask again once one of them approves."
|
|
|
|
| 1035 |
tools.extend(agent_runtime.tool_specs(session, snapshot=snapshot))
|
| 1036 |
if turn.get("openWork"):
|
| 1037 |
tools = [tool for tool in tools if tool["function"]["name"] == "open_items"]
|
| 1038 |
+
if turn.get("conversation"):
|
| 1039 |
+
tools = []
|
| 1040 |
if turn.get("admittedTools"):
|
| 1041 |
tools = [tool for tool in tools if tool["function"]["name"] in set(turn["admittedTools"])]
|
| 1042 |
if turn.get("memoryOnly"):
|
|
|
|
| 1047 |
"You are the Loopable Assistant. Use tools for facts. Writes run at once. Deletes need the user's yes.")
|
| 1048 |
if turn.get("context"):
|
| 1049 |
prompt += "\n\n" + turn["context"]
|
| 1050 |
+
if turn.get("conversation"):
|
| 1051 |
+
prompt += CONVERSATION_PROMPT
|
| 1052 |
if turn.get("toolShareRequests"):
|
| 1053 |
prompt += ("\nThis turn concerns a pending tool-share approval only. Use the prior conversation to identify "
|
| 1054 |
"the request. Ask which request when the user's approval is ambiguous. "
|
|
|
|
| 2029 |
memory_only = dock is None and not target and replay is None and assistant_memory.admits(question)
|
| 2030 |
routed = _route(session, question) if dock is None and not open_work and not admitted and not memory_only and not share_requests and not agent_runtime.has_attachments() and not target and replay is None else {
|
| 2031 |
"database": target, "auto": False, "alternatives": []}
|
| 2032 |
+
# D-2673: an app turn with no data subject reaches the model with no tools, never the no-source refusal.
|
| 2033 |
+
conversation = (door == "app" and dock is None and replay is None and not also_as
|
| 2034 |
+
and _conversation(question, routed))
|
| 2035 |
+
if conversation:
|
| 2036 |
+
routed = {"database": "", "label": "", "reason": "", "auto": True, "alternatives": []}
|
| 2037 |
target = routed["database"]
|
| 2038 |
+
route_refusal = (None if conversation or dock is not None or open_work or admitted or memory_only or share_requests or agent_runtime.has_attachments() else
|
| 2039 |
QUERY_NO_SOURCE_MATCHED if not target and replay is None else routed.get("refusal"))
|
| 2040 |
|
| 2041 |
# Snapshot turns plan mirrors from schema. Dock turns read through permissioned tools.
|
|
|
|
| 2085 |
turn["admittedTools"] = sorted(admitted)
|
| 2086 |
if memory_only:
|
| 2087 |
turn["memoryOnly"] = True
|
| 2088 |
+
if conversation:
|
| 2089 |
+
turn["conversation"] = True
|
| 2090 |
turn["memoryCompanyRequested"] = assistant_memory.company_requested(question)
|
| 2091 |
if snapshot is not None:
|
| 2092 |
turn["memorySources"] = [{"database": snapshot["database"],
|
|
|
|
| 2767 |
return candidates
|
| 2768 |
|
| 2769 |
|
| 2770 |
+
def _conversation(question, routed):
|
| 2771 |
+
"""True when an auto route found no database or the question holds no data word."""
|
| 2772 |
+
from harness import semantic as sem
|
| 2773 |
+
return bool(routed.get("auto")) and (
|
| 2774 |
+
not routed.get("database")
|
| 2775 |
+
or not set(sem._route_tokens(question)) - set(sem._route_tokens(_CHAT_WORDS)))
|
| 2776 |
+
|
| 2777 |
+
|
| 2778 |
def _route(session, question):
|
| 2779 |
from harness import semantic as sem
|
| 2780 |
candidates = _route_candidates(session)
|
|
|
|
| 3341 |
"database": "", "label": "", "reason": "", "auto": False, "alternatives": []}}
|
| 3342 |
routed = _route(session, question) if not database else {
|
| 3343 |
"database": database, "label": "", "reason": "", "auto": False, "alternatives": []}
|
| 3344 |
+
if _conversation(question, routed):
|
| 3345 |
+
# D-2673: a greeting or a question no database covers continues to chat, never a Clarify card.
|
| 3346 |
+
return {"status": "continue_chat", "routedTo": {
|
| 3347 |
+
"database": "", "label": "", "reason": "", "auto": False, "alternatives": []}}
|
| 3348 |
database = routed["database"]
|
| 3349 |
if database:
|
| 3350 |
_semantic_authorize(session, database, require_answerable=not routed["auto"])
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
73b4f9eca2b37df6a5d4fddad53be541c03d02570766457d25676b96105a4a8a
|