Deploy Trio Co-Worker (Apple-style UI, state-sync safety, Fusion pod and AI from settings, monthly/quarterly cycles)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .devcontainer/devcontainer.json +2 -2
- .devcontainer/start.sh +1 -1
- Dockerfile +1 -1
- README.md +4 -2
- config/coworker.yaml +1 -1
- coworker/README.md +2 -2
- coworker/__main__.py +5 -5
- coworker/api/app.py +3 -3
- coworker/api/routes/admin.py +9 -0
- coworker/api/routes/assistant.py +50 -0
- coworker/api/schemas.py +6 -1
- coworker/config.py +20 -2
- coworker/graph/nodes/report.py +4 -1
- coworker/graph/services.py +5 -2
- coworker/platform/assets/wordmark-horizontal-light.svg +1 -0
- coworker/platform/brand.py +34 -0
- coworker/platform/egress.py +47 -0
- coworker/platform/hermes.py +169 -0
- coworker/platform/llm_settings.py +13 -0
- coworker/platform/migrations/008_schedule_cadence.sql +5 -0
- coworker/platform/patchcycle.py +26 -0
- coworker/platform/pods.py +52 -2
- coworker/platform/readiness.py +4 -2
- coworker/platform/scheduler.py +38 -3
- coworker/platform/statesync.py +46 -0
- coworker/platform/test_script.py +2 -1
- coworker/tests/test_brand.py +33 -0
- coworker/tests/test_cadence.py +80 -0
- coworker/tests/test_consultant.py +2 -0
- coworker/tests/test_hermes.py +227 -0
- coworker/tests/test_llm_settings.py +43 -0
- coworker/tests/test_pods.py +69 -0
- coworker/tests/test_supabase.py +41 -0
- coworker/workflows/activities.py +2 -2
- coworker/workflows/client.py +2 -2
- deploy/.env.example +1 -1
- deploy/DEPLOY.md +17 -1
- deploy/docker-compose.yml +1 -1
- desktop/package.json +4 -4
- desktop/src/loading.html +1 -1
- desktop/src/main.js +5 -5
- desktop/src/settings.html +1 -1
- docker-compose.temporal.yml +1 -1
- docs/design/UI-APPLE.md +486 -0
- docs/design/UI-RESEARCH-RECOVERY.md +52 -0
- docs/design/brand/BRAND.md +116 -0
- docs/design/brand/app-icon.svg +1 -0
- docs/design/brand/favicon.svg +1 -0
- docs/design/brand/logo-mark-dark.svg +1 -0
- docs/design/brand/logo-mark-mono-black.svg +1 -0
.devcontainer/devcontainer.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
// Runs the whole product in a GitHub Codespace (a cloud machine with 8 GB of memory), so full browser runs work
|
| 3 |
// without a laptop or a paid server. The application starts by itself; open the forwarded port 8800.
|
| 4 |
-
"name": "
|
| 5 |
"build": { "dockerfile": "../Dockerfile", "context": ".." },
|
| 6 |
"hostRequirements": { "cpus": 2, "memory": "8gb" },
|
| 7 |
// root inside this throwaway machine: avoids file-ownership differences between the image and the Codespace
|
|
@@ -18,7 +18,7 @@
|
|
| 18 |
},
|
| 19 |
"forwardPorts": [8800],
|
| 20 |
"portsAttributes": {
|
| 21 |
-
"8800": { "label": "
|
| 22 |
},
|
| 23 |
"postStartCommand": "sh .devcontainer/start.sh"
|
| 24 |
}
|
|
|
|
| 1 |
{
|
| 2 |
// Runs the whole product in a GitHub Codespace (a cloud machine with 8 GB of memory), so full browser runs work
|
| 3 |
// without a laptop or a paid server. The application starts by itself; open the forwarded port 8800.
|
| 4 |
+
"name": "Trio Co-Worker (demo)",
|
| 5 |
"build": { "dockerfile": "../Dockerfile", "context": ".." },
|
| 6 |
"hostRequirements": { "cpus": 2, "memory": "8gb" },
|
| 7 |
// root inside this throwaway machine: avoids file-ownership differences between the image and the Codespace
|
|
|
|
| 18 |
},
|
| 19 |
"forwardPorts": [8800],
|
| 20 |
"portsAttributes": {
|
| 21 |
+
"8800": { "label": "Trio Co-Worker", "onAutoForward": "openBrowser" }
|
| 22 |
},
|
| 23 |
"postStartCommand": "sh .devcontainer/start.sh"
|
| 24 |
}
|
.devcontainer/start.sh
CHANGED
|
@@ -27,7 +27,7 @@ else
|
|
| 27 |
fi
|
| 28 |
|
| 29 |
echo ""
|
| 30 |
-
echo "
|
| 31 |
echo " Open the PORTS tab, then the globe icon next to port 8800."
|
| 32 |
echo " Sign in with user: admin password: $(cat /data/demo-password.txt)"
|
| 33 |
echo ""
|
|
|
|
| 27 |
fi
|
| 28 |
|
| 29 |
echo ""
|
| 30 |
+
echo " Trio Co-Worker is running."
|
| 31 |
echo " Open the PORTS tab, then the globe icon next to port 8800."
|
| 32 |
echo " Sign in with user: admin password: $(cat /data/demo-password.txt)"
|
| 33 |
echo ""
|
Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
#
|
| 2 |
# Build from the project root: docker build -t patch-coworker:1.0.0 .
|
| 3 |
# Run with deploy/docker-compose.yml (adds Temporal and an HTTPS proxy). All customer data lives in the /data volume.
|
| 4 |
|
|
|
|
| 1 |
+
# Trio Co-Worker: one application image (web app + API + workflow worker + test executor + practice pod).
|
| 2 |
# Build from the project root: docker build -t patch-coworker:1.0.0 .
|
| 3 |
# Run with deploy/docker-compose.yml (adds Temporal and an HTTPS proxy). All customer data lives in the /data volume.
|
| 4 |
|
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: "🧪"
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: gray
|
|
@@ -8,7 +8,9 @@ app_port: 8800
|
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
|
| 13 |
A team of AI agents that checks whether a quarterly Oracle Fusion patch is safe: it researches what the patch
|
| 14 |
changes, chooses test scenarios, runs them in a real browser, analyses failures and produces a Ready / Not ready
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Trio Co-Worker
|
| 3 |
emoji: "🧪"
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: gray
|
|
|
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
| 11 |
+
<p><img src="docs/design/brand/wordmark-horizontal-light.svg" alt="Trio Co-Worker" height="40"></p>
|
| 12 |
+
|
| 13 |
+
# Trio Co-Worker
|
| 14 |
|
| 15 |
A team of AI agents that checks whether a quarterly Oracle Fusion patch is safe: it researches what the patch
|
| 16 |
changes, chooses test scenarios, runs them in a real browser, analyses failures and produces a Ready / Not ready
|
config/coworker.yaml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
#
|
| 2 |
# Secrets never go here: they live in the vault (var/secrets/vault.json or FPT_SECRET_* env).
|
| 3 |
# The only pod in this project is the LOCAL MOCK app (mock-app/, 127.0.0.1:3100). It is not Oracle Fusion.
|
| 4 |
|
|
|
|
| 1 |
+
# Trio Co-Worker: NON-SECRET configuration (env vars and .env override every key; env wins).
|
| 2 |
# Secrets never go here: they live in the vault (var/secrets/vault.json or FPT_SECRET_* env).
|
| 3 |
# The only pod in this project is the LOCAL MOCK app (mock-app/, 127.0.0.1:3100). It is not Oracle Fusion.
|
| 4 |
|
coworker/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
> **Mock app, not Oracle Fusion.** The only "pod" is the local mock (`mock-app/`, http://127.0.0.1:3100). No Oracle Fusion
|
| 4 |
> pod, credentials or client data exist in this project. Every report, the web app and the desktop app say so.
|
|
@@ -24,7 +24,7 @@ fpt.cmd down & rem stop what `up` started (
|
|
| 24 |
| `fpt.cmd up` / `down` | Temporal + worker (when `orchestrator: temporal`) + mock (if down) + backend (`/` = app, `/api` = API, `/api/docs` = OpenAPI UI). Builds `web/dist` if missing |
|
| 25 |
| `fpt.cmd web-dev` | Vite dev server on http://127.0.0.1:5173 proxying `/api` to :8800 (start the API with `fpt.cmd api`) |
|
| 26 |
| `fpt.cmd desktop` | Electron app in local mode (spawns the backend on a free port) |
|
| 27 |
-
| `fpt.cmd package` | builds `web/dist`, then the NSIS installer `desktop\dist\
|
| 28 |
| `fpt.cmd create-user --username U --role viewer\|consultant\|qa_approver\|admin [--password-env VAR \| --password-stdin]` | local user |
|
| 29 |
| `fpt.cmd test` | coworker pytest + coworker selftest + architecture selftest (27) + triage tests (71) |
|
| 30 |
| `fpt.cmd selftest [--live]` | offline end-to-end checks (35); `--live` adds 3 real P2P cases in Chromium against the mock |
|
|
|
|
| 1 |
+
# Trio Co-Worker (pilot)
|
| 2 |
|
| 3 |
> **Mock app, not Oracle Fusion.** The only "pod" is the local mock (`mock-app/`, http://127.0.0.1:3100). No Oracle Fusion
|
| 4 |
> pod, credentials or client data exist in this project. Every report, the web app and the desktop app say so.
|
|
|
|
| 24 |
| `fpt.cmd up` / `down` | Temporal + worker (when `orchestrator: temporal`) + mock (if down) + backend (`/` = app, `/api` = API, `/api/docs` = OpenAPI UI). Builds `web/dist` if missing |
|
| 25 |
| `fpt.cmd web-dev` | Vite dev server on http://127.0.0.1:5173 proxying `/api` to :8800 (start the API with `fpt.cmd api`) |
|
| 26 |
| `fpt.cmd desktop` | Electron app in local mode (spawns the backend on a free port) |
|
| 27 |
+
| `fpt.cmd package` | builds `web/dist`, then the NSIS installer `desktop\dist\Trio Co-Worker Setup 1.0.0.exe` (unsigned) |
|
| 28 |
| `fpt.cmd create-user --username U --role viewer\|consultant\|qa_approver\|admin [--password-env VAR \| --password-stdin]` | local user |
|
| 29 |
| `fpt.cmd test` | coworker pytest + coworker selftest + architecture selftest (27) + triage tests (71) |
|
| 30 |
| `fpt.cmd selftest [--live]` | offline end-to-end checks (35); `--live` adds 3 real P2P cases in Chromium against the mock |
|
coworker/__main__.py
CHANGED
|
@@ -205,7 +205,7 @@ def cmd_up(a) -> int:
|
|
| 205 |
if loopback_ok(url + "/api/ready", timeout=2):
|
| 206 |
break
|
| 207 |
time.sleep(0.5)
|
| 208 |
-
print(f"\
|
| 209 |
if cfg.orchestrator == "temporal":
|
| 210 |
print(f"Temporal Web UI: {cfg.temporal_ui_url} (worker log var/logs/worker.out.log)", flush=True)
|
| 211 |
print("Target: mock app on " + cfg.pod_base_url + " -- MOCK APP, NOT ORACLE FUSION. Ctrl+C or `fpt.cmd down` to stop.", flush=True)
|
|
@@ -346,16 +346,16 @@ def cmd_state(a) -> int:
|
|
| 346 |
return 0
|
| 347 |
if a.action == "restore":
|
| 348 |
if (cfg.home / "fpt.sqlite").exists():
|
|
|
|
| 349 |
print(f"{cfg.home} already has data: nothing restored")
|
| 350 |
return 0
|
| 351 |
# the egress gate needs an audit log; while FPT_HOME is still empty it writes to a throwaway one
|
| 352 |
with tempfile.TemporaryDirectory() as tmp:
|
| 353 |
scratch = build_services(cfg.model_copy(update={"fpt_home": Path(tmp)}))
|
| 354 |
client = sb.Supabase(cfg, scratch.egress, None)
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
print(f"state restore failed: {e}")
|
| 359 |
return 0 if a.soft else 1
|
| 360 |
print("state restored from Supabase Storage" if done else "no saved state yet: starting empty")
|
| 361 |
return 0
|
|
|
|
| 205 |
if loopback_ok(url + "/api/ready", timeout=2):
|
| 206 |
break
|
| 207 |
time.sleep(0.5)
|
| 208 |
+
print(f"\nTrio Co-Worker is up: {url} (API docs {url}/api/docs)", flush=True)
|
| 209 |
if cfg.orchestrator == "temporal":
|
| 210 |
print(f"Temporal Web UI: {cfg.temporal_ui_url} (worker log var/logs/worker.out.log)", flush=True)
|
| 211 |
print("Target: mock app on " + cfg.pod_base_url + " -- MOCK APP, NOT ORACLE FUSION. Ctrl+C or `fpt.cmd down` to stop.", flush=True)
|
|
|
|
| 346 |
return 0
|
| 347 |
if a.action == "restore":
|
| 348 |
if (cfg.home / "fpt.sqlite").exists():
|
| 349 |
+
(cfg.home / statesync.FAILED_MARKER).unlink(missing_ok=True) # a stale marker from an earlier start
|
| 350 |
print(f"{cfg.home} already has data: nothing restored")
|
| 351 |
return 0
|
| 352 |
# the egress gate needs an audit log; while FPT_HOME is still empty it writes to a throwaway one
|
| 353 |
with tempfile.TemporaryDirectory() as tmp:
|
| 354 |
scratch = build_services(cfg.model_copy(update={"fpt_home": Path(tmp)}))
|
| 355 |
client = sb.Supabase(cfg, scratch.egress, None)
|
| 356 |
+
done, err = statesync.restore_at_boot(cfg, client)
|
| 357 |
+
if err:
|
| 358 |
+
print(f"state restore failed (saving to the bucket is paused until the next start): {err}")
|
|
|
|
| 359 |
return 0 if a.soft else 1
|
| 360 |
print("state restored from Supabase Storage" if done else "no saved state yet: starting empty")
|
| 361 |
return 0
|
coworker/api/app.py
CHANGED
|
@@ -15,7 +15,7 @@ from ..graph.services import Services, build_services
|
|
| 15 |
from ..platform.scheduler import Scheduler
|
| 16 |
from . import errors
|
| 17 |
from .middleware import RequestContext, setup_logging
|
| 18 |
-
from .routes import admin, auth, chat, consultant, gates, live, llm, pods, review, runs, screens
|
| 19 |
from .runner import RunManager
|
| 20 |
|
| 21 |
log = logging.getLogger("fpt.api")
|
|
@@ -73,7 +73,7 @@ def create_app(svc: Services | None = None, cfg: Settings | None = None, *, back
|
|
| 73 |
if syncer:
|
| 74 |
syncer.stop()
|
| 75 |
|
| 76 |
-
app = FastAPI(title="
|
| 77 |
description="Pilot backend. Runs ONLY against the local mock app, not Oracle Fusion.",
|
| 78 |
docs_url="/api/docs", redoc_url=None, openapi_url="/api/openapi.json")
|
| 79 |
app.state.svc, app.state.runs, app.state.scheduler, app.state.inline_worker = svc, run_mgr, sched, not background
|
|
@@ -85,7 +85,7 @@ def create_app(svc: Services | None = None, cfg: Settings | None = None, *, back
|
|
| 85 |
app.add_middleware(RequestContext)
|
| 86 |
|
| 87 |
api = APIRouter(prefix="/api")
|
| 88 |
-
for r in (auth.router, runs.router, gates.router, review.router, admin.router, pods.router, screens.router, consultant.router, live.router, chat.router, llm.router):
|
| 89 |
api.include_router(r)
|
| 90 |
app.include_router(api)
|
| 91 |
|
|
|
|
| 15 |
from ..platform.scheduler import Scheduler
|
| 16 |
from . import errors
|
| 17 |
from .middleware import RequestContext, setup_logging
|
| 18 |
+
from .routes import admin, assistant, auth, chat, consultant, gates, live, llm, pods, review, runs, screens
|
| 19 |
from .runner import RunManager
|
| 20 |
|
| 21 |
log = logging.getLogger("fpt.api")
|
|
|
|
| 73 |
if syncer:
|
| 74 |
syncer.stop()
|
| 75 |
|
| 76 |
+
app = FastAPI(title="Trio Co-Worker API", version=VERSION, lifespan=lifespan,
|
| 77 |
description="Pilot backend. Runs ONLY against the local mock app, not Oracle Fusion.",
|
| 78 |
docs_url="/api/docs", redoc_url=None, openapi_url="/api/openapi.json")
|
| 79 |
app.state.svc, app.state.runs, app.state.scheduler, app.state.inline_worker = svc, run_mgr, sched, not background
|
|
|
|
| 85 |
app.add_middleware(RequestContext)
|
| 86 |
|
| 87 |
api = APIRouter(prefix="/api")
|
| 88 |
+
for r in (auth.router, runs.router, gates.router, review.router, admin.router, pods.router, screens.router, consultant.router, live.router, chat.router, assistant.router, llm.router):
|
| 89 |
api.include_router(r)
|
| 90 |
app.include_router(api)
|
| 91 |
|
coworker/api/routes/admin.py
CHANGED
|
@@ -43,6 +43,9 @@ def ready(request: Request):
|
|
| 43 |
syncer = getattr(request.app.state, "syncer", None)
|
| 44 |
body["saved_state"] = {"on": syncer is not None, "last_saved_at": (svc.extra.get("state_last") or {}).get("saved_at"),
|
| 45 |
"ok": syncer.last_error is None if syncer else None}
|
|
|
|
|
|
|
|
|
|
| 46 |
if not ok:
|
| 47 |
import json
|
| 48 |
return Response(json.dumps(body), status_code=503, media_type="application/json")
|
|
@@ -113,6 +116,12 @@ def schedule_create(body: ScheduleIn, request: Request, user: Principal = Depend
|
|
| 113 |
raise ApiError(422, "VALIDATION", "interval schedules need every_minutes")
|
| 114 |
if body.kind == "daily" and not body.at:
|
| 115 |
raise ApiError(422, "VALIDATION", "daily schedules need at (HH:MM, UTC)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
s = request.app.state.scheduler.create(body.model_dump(), user.username)
|
| 117 |
request.app.state.svc.audit.append("schedule.created", actor=user.username, payload=s)
|
| 118 |
return s
|
|
|
|
| 43 |
syncer = getattr(request.app.state, "syncer", None)
|
| 44 |
body["saved_state"] = {"on": syncer is not None, "last_saved_at": (svc.extra.get("state_last") or {}).get("saved_at"),
|
| 45 |
"ok": syncer.last_error is None if syncer else None}
|
| 46 |
+
if syncer is not None:
|
| 47 |
+
from ...platform import statesync
|
| 48 |
+
body["saved_state"]["paused"] = statesync.restore_failed(svc.cfg.home) # the boot restore failed: not saving, to protect the saved copy
|
| 49 |
if not ok:
|
| 50 |
import json
|
| 51 |
return Response(json.dumps(body), status_code=503, media_type="application/json")
|
|
|
|
| 116 |
raise ApiError(422, "VALIDATION", "interval schedules need every_minutes")
|
| 117 |
if body.kind == "daily" and not body.at:
|
| 118 |
raise ApiError(422, "VALIDATION", "daily schedules need at (HH:MM, UTC)")
|
| 119 |
+
if body.kind in ("monthly", "quarterly") and not (body.at and body.day):
|
| 120 |
+
raise ApiError(422, "VALIDATION", f"{body.kind} schedules need day (1-28) and at (HH:MM, UTC)")
|
| 121 |
+
if body.kind == "quarterly" and not body.month:
|
| 122 |
+
raise ApiError(422, "VALIDATION", "quarterly schedules need month (the first month of the cycle, 1-12)")
|
| 123 |
+
if body.pod_id is not None and not request.app.state.svc.db.one("SELECT id FROM pods WHERE id=?", (body.pod_id,)):
|
| 124 |
+
raise ApiError(422, "VALIDATION", "that test environment does not exist")
|
| 125 |
s = request.app.state.scheduler.create(body.model_dump(), user.username)
|
| 126 |
request.app.state.svc.audit.append("schedule.created", actor=user.username, payload=s)
|
| 127 |
return s
|
coworker/api/routes/assistant.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""/api/assistant: "Ask a question" answered by the Hermes assistant (platform/hermes.py), a separate service.
|
| 2 |
+
|
| 3 |
+
Off by default (FPT_HERMES_ENABLED): then /ask answers 409 HERMES_OFF and the web app keeps using the built-in chat
|
| 4 |
+
(/api/chat). Same permission as the built-in chat ("read"); rate limited per user. Mock app, not Oracle Fusion."""
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
from fastapi import APIRouter, Depends, Request
|
| 8 |
+
from pydantic import BaseModel, ConfigDict, Field
|
| 9 |
+
|
| 10 |
+
from ...platform import hermes
|
| 11 |
+
from ..auth import Principal, require
|
| 12 |
+
from ..errors import ApiError
|
| 13 |
+
|
| 14 |
+
router = APIRouter(prefix="/assistant", tags=["assistant"])
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class AskIn(BaseModel):
|
| 18 |
+
model_config = ConfigDict(extra="forbid")
|
| 19 |
+
question: str = Field(min_length=1, max_length=hermes.MAX_QUESTION)
|
| 20 |
+
conversation_id: str | None = Field(default=None, max_length=80)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class AskOut(BaseModel):
|
| 24 |
+
answer: str
|
| 25 |
+
conversation_id: str
|
| 26 |
+
model: str
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class AssistantStatus(BaseModel):
|
| 30 |
+
enabled: bool
|
| 31 |
+
configured: bool
|
| 32 |
+
reachable: bool | None = None
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
@router.post("/ask", response_model=AskOut)
|
| 36 |
+
def ask(body: AskIn, request: Request, user: Principal = Depends(require("read"))):
|
| 37 |
+
"""Ask Hermes one question. Pass the returned conversation_id to continue the same conversation.
|
| 38 |
+
Errors: 409 HERMES_OFF, 503 HERMES_NOT_CONFIGURED, 502 HERMES_UNREACHABLE / HERMES_KEY_REJECTED / HERMES_ERROR,
|
| 39 |
+
504 HERMES_TIMEOUT, 429 RATE_LIMITED, 404 NOT_FOUND (unknown or someone else's conversation)."""
|
| 40 |
+
try:
|
| 41 |
+
return hermes.ask(request.app.state.svc, user, body.question, body.conversation_id)
|
| 42 |
+
except hermes.HermesError as e:
|
| 43 |
+
headers = {"Retry-After": str(e.retry_after)} if e.retry_after else None
|
| 44 |
+
raise ApiError(e.status, e.code, e.detail, headers=headers) from e
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
@router.get("/status", response_model=AssistantStatus)
|
| 48 |
+
def status(request: Request, user: Principal = Depends(require("read"))):
|
| 49 |
+
"""Whether the Hermes assistant is on, configured (URL and key present) and reachable (checked at most once a minute)."""
|
| 50 |
+
return hermes.status(request.app.state.svc)
|
coworker/api/schemas.py
CHANGED
|
@@ -144,6 +144,7 @@ class PodRow(BaseModel):
|
|
| 144 |
base_url: str
|
| 145 |
environment: str
|
| 146 |
modules: list[str]
|
|
|
|
| 147 |
notes: str | None = None
|
| 148 |
enabled: bool
|
| 149 |
is_default: bool
|
|
@@ -261,9 +262,13 @@ class KillIn(Strict):
|
|
| 261 |
|
| 262 |
|
| 263 |
class ScheduleIn(Strict):
|
| 264 |
-
kind: Literal["interval", "daily"]
|
| 265 |
every_minutes: int | None = Field(default=None, ge=1, le=7 * 24 * 60)
|
| 266 |
at: str | None = Field(default=None, pattern=r"^\d{2}:\d{2}$")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
modules: list[str] = Field(default_factory=list)
|
| 268 |
include_p2: bool = False
|
| 269 |
playwright_mode: Literal["live", "stub"] = "live"
|
|
|
|
| 144 |
base_url: str
|
| 145 |
environment: str
|
| 146 |
modules: list[str]
|
| 147 |
+
from_server_settings: bool = False # defined by FPT_FUSION_BASE_URL: re-created at every start, cannot be deleted in the app
|
| 148 |
notes: str | None = None
|
| 149 |
enabled: bool
|
| 150 |
is_default: bool
|
|
|
|
| 262 |
|
| 263 |
|
| 264 |
class ScheduleIn(Strict):
|
| 265 |
+
kind: Literal["interval", "daily", "monthly", "quarterly"]
|
| 266 |
every_minutes: int | None = Field(default=None, ge=1, le=7 * 24 * 60)
|
| 267 |
at: str | None = Field(default=None, pattern=r"^\d{2}:\d{2}$")
|
| 268 |
+
day: int | None = Field(default=None, ge=1, le=28) # monthly / quarterly: day of the month (UTC)
|
| 269 |
+
month: int | None = Field(default=None, ge=1, le=12) # quarterly: the first month of the cycle (runs again every third month)
|
| 270 |
+
pod_id: int | None = None # the test environment to run on (default: the server's default pod)
|
| 271 |
+
patch_id: str | None = Field(default=None, max_length=40) # the patch name to record, e.g. 26C or 2026-10
|
| 272 |
modules: list[str] = Field(default_factory=list)
|
| 273 |
include_p2: bool = False
|
| 274 |
playwright_mode: Literal["live", "stub"] = "live"
|
coworker/config.py
CHANGED
|
@@ -37,7 +37,7 @@ class Settings(BaseSettings):
|
|
| 37 |
web_dist: Path = Field(default=ROOT / "web" / "dist", validation_alias=_alias("fpt_web_dist", "web_dist"))
|
| 38 |
oidc_issuer: str = ""
|
| 39 |
# shown in the menu and on the sign-in page (a reseller or customer can set its own)
|
| 40 |
-
product_name: str = Field("
|
| 41 |
org_name: str = Field("", validation_alias=_alias("fpt_org_name", "org_name"))
|
| 42 |
|
| 43 |
# ---- Supabase (optional): identity provider for sign-in / registration, and storage for the encrypted state archive.
|
|
@@ -126,6 +126,9 @@ class Settings(BaseSettings):
|
|
| 126 |
ollama_model: str = "llava-phi3:latest"
|
| 127 |
llm_frontier: Literal["off", "stub", "frontier"] = "off"
|
| 128 |
frontier_base_url: str = ""
|
|
|
|
|
|
|
|
|
|
| 129 |
frontier_model: str = "mistral-large-2512"
|
| 130 |
frontier_timeout_s: float = Field(120.0, validation_alias=_alias("fpt_frontier_timeout_s", "frontier_timeout_s"))
|
| 131 |
frontier_max_tokens: int = Field(4096, validation_alias=_alias("fpt_frontier_max_tokens", "frontier_max_tokens"))
|
|
@@ -165,12 +168,27 @@ class Settings(BaseSettings):
|
|
| 165 |
chat_rate_per_minute: int = 20
|
| 166 |
chat_action_ttl_s: int = 600
|
| 167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
patch_watch_enabled: bool = True
|
| 169 |
patch_watch_interval_s: int = 300
|
| 170 |
patch_watch_autostart: bool = False
|
| 171 |
scheduler_tick_s: int = 30
|
| 172 |
|
| 173 |
-
@field_validator("research_allowed_domains", "cors_origins", "local_llm_hosts", "live_view_block_modules", mode="before")
|
| 174 |
@classmethod
|
| 175 |
def _csv(cls, v):
|
| 176 |
if isinstance(v, str):
|
|
|
|
| 37 |
web_dist: Path = Field(default=ROOT / "web" / "dist", validation_alias=_alias("fpt_web_dist", "web_dist"))
|
| 38 |
oidc_issuer: str = ""
|
| 39 |
# shown in the menu and on the sign-in page (a reseller or customer can set its own)
|
| 40 |
+
product_name: str = Field("Trio Co-Worker", validation_alias=_alias("fpt_product_name", "product_name"))
|
| 41 |
org_name: str = Field("", validation_alias=_alias("fpt_org_name", "org_name"))
|
| 42 |
|
| 43 |
# ---- Supabase (optional): identity provider for sign-in / registration, and storage for the encrypted state archive.
|
|
|
|
| 126 |
ollama_model: str = "llava-phi3:latest"
|
| 127 |
llm_frontier: Literal["off", "stub", "frontier"] = "off"
|
| 128 |
frontier_base_url: str = ""
|
| 129 |
+
# With no model settings saved in the app, an https FRONTIER_BASE_URL plus a key in the secrets (FPT_SECRET_FRONTIER_API_KEY)
|
| 130 |
+
# switches the external model on at start-up, so a restart or a lost snapshot cannot silently turn the AI off.
|
| 131 |
+
frontier_auto: bool = Field(True, validation_alias=_alias("fpt_frontier_auto", "frontier_auto"))
|
| 132 |
frontier_model: str = "mistral-large-2512"
|
| 133 |
frontier_timeout_s: float = Field(120.0, validation_alias=_alias("fpt_frontier_timeout_s", "frontier_timeout_s"))
|
| 134 |
frontier_max_tokens: int = Field(4096, validation_alias=_alias("fpt_frontier_max_tokens", "frontier_max_tokens"))
|
|
|
|
| 168 |
chat_rate_per_minute: int = 20
|
| 169 |
chat_action_ttl_s: int = 600
|
| 170 |
|
| 171 |
+
# Hermes assistant ("Ask a question" answered by the Hermes Agent Space, OpenAI-compatible /v1). Off by default: the
|
| 172 |
+
# built-in chat stays in use. The API key is a secret (vault HERMES_API_KEY / env FPT_SECRET_HERMES_API_KEY), never here.
|
| 173 |
+
hermes_url: str = Field("", validation_alias=_alias("fpt_hermes_url", "hermes_url"))
|
| 174 |
+
hermes_enabled: bool = Field(False, validation_alias=_alias("fpt_hermes_enabled", "hermes_enabled"))
|
| 175 |
+
hermes_timeout_s: float = Field(120.0, validation_alias=_alias("fpt_hermes_timeout_s", "hermes_timeout_s"))
|
| 176 |
+
hermes_rate_per_minute: int = Field(6, validation_alias=_alias("fpt_hermes_rate_per_minute", "hermes_rate_per_minute"))
|
| 177 |
+
|
| 178 |
+
# An Oracle Fusion TEST pod that exists from the environment: created at start-up when the saved data has none, so a
|
| 179 |
+
# restart or a lost snapshot never removes it. Its test user comes from the secrets FPT_SECRET_FUSION_USERNAME and
|
| 180 |
+
# FPT_SECRET_FUSION_PASSWORD (never from a setting). Unset = pods are managed in the app only.
|
| 181 |
+
fusion_base_url: str = Field("", validation_alias=_alias("fpt_fusion_base_url", "fusion_base_url"))
|
| 182 |
+
fusion_name: str = Field("Oracle Fusion test pod", validation_alias=_alias("fpt_fusion_name", "fusion_name"))
|
| 183 |
+
fusion_environment: str = Field("test", validation_alias=_alias("fpt_fusion_environment", "fusion_environment"))
|
| 184 |
+
fusion_modules: list[str] = Field(default_factory=lambda: ["AP"], validation_alias=_alias("fpt_fusion_modules", "fusion_modules"))
|
| 185 |
+
|
| 186 |
patch_watch_enabled: bool = True
|
| 187 |
patch_watch_interval_s: int = 300
|
| 188 |
patch_watch_autostart: bool = False
|
| 189 |
scheduler_tick_s: int = 30
|
| 190 |
|
| 191 |
+
@field_validator("research_allowed_domains", "cors_origins", "local_llm_hosts", "live_view_block_modules", "fusion_modules", mode="before")
|
| 192 |
@classmethod
|
| 193 |
def _csv(cls, v):
|
| 194 |
if isinstance(v, str):
|
coworker/graph/nodes/report.py
CHANGED
|
@@ -13,6 +13,7 @@ from ...adapters.pdf import html_to_pdf
|
|
| 13 |
from ...config import MOCK_BANNER
|
| 14 |
from ...llm.base import LLMRequest, Sensitivity
|
| 15 |
from ...llm.schemas import ExecSummary
|
|
|
|
| 16 |
from .triage import run_triage
|
| 17 |
|
| 18 |
STUB_BANNER = "STUB RUN: synthetic results from p2p_graph.py stubs. No browser, no mock-app, no Fusion. Not evidence of anything."
|
|
@@ -77,11 +78,13 @@ def reporter(state, config, svc) -> dict:
|
|
| 77 |
bundle = out / "bundle.html"
|
| 78 |
bundle.write_text(
|
| 79 |
"<!doctype html><html><head><meta charset='utf-8'><title>Go/no-go bundle " + _html.escape(m) + "</title></head><body>"
|
|
|
|
| 80 |
f"<div style='background:#b00020;color:#fff;padding:8px;font-weight:bold'>{_html.escape(MOCK_BANNER.upper())}</div>"
|
| 81 |
f"<h1>{_html.escape(m)}: {_html.escape(s['decision'])} <small>(decision source: {_html.escape(report_rule.DECISION_SOURCE)})</small></h1>"
|
| 82 |
f"<h2>Executive summary</h2><p>{_html.escape(summary_text)}</p><p><i>Summary route: {resp.route.value}/{_html.escape(resp.model)}</i></p><hr>"
|
| 83 |
-
+ (inner.group(1) if inner else body) + "</body></html>", encoding="utf-8")
|
| 84 |
pdf = html_to_pdf(bundle, out / "go-no-go.pdf")
|
|
|
|
| 85 |
summ = {"run_id": run_id, "module": m, "patch_id": state.get("patch_id"), "source": tri.get("source"),
|
| 86 |
"run_mode": tri.get("run_mode"), "target": MOCK_BANNER, "decision": s["decision"],
|
| 87 |
"decision_source": report_rule.DECISION_SOURCE,
|
|
|
|
| 13 |
from ...config import MOCK_BANNER
|
| 14 |
from ...llm.base import LLMRequest, Sensitivity
|
| 15 |
from ...llm.schemas import ExecSummary
|
| 16 |
+
from ...platform import brand
|
| 17 |
from .triage import run_triage
|
| 18 |
|
| 19 |
STUB_BANNER = "STUB RUN: synthetic results from p2p_graph.py stubs. No browser, no mock-app, no Fusion. Not evidence of anything."
|
|
|
|
| 78 |
bundle = out / "bundle.html"
|
| 79 |
bundle.write_text(
|
| 80 |
"<!doctype html><html><head><meta charset='utf-8'><title>Go/no-go bundle " + _html.escape(m) + "</title></head><body>"
|
| 81 |
+
+ brand.header_html() +
|
| 82 |
f"<div style='background:#b00020;color:#fff;padding:8px;font-weight:bold'>{_html.escape(MOCK_BANNER.upper())}</div>"
|
| 83 |
f"<h1>{_html.escape(m)}: {_html.escape(s['decision'])} <small>(decision source: {_html.escape(report_rule.DECISION_SOURCE)})</small></h1>"
|
| 84 |
f"<h2>Executive summary</h2><p>{_html.escape(summary_text)}</p><p><i>Summary route: {resp.route.value}/{_html.escape(resp.model)}</i></p><hr>"
|
| 85 |
+
+ (inner.group(1) if inner else body) + brand.footer_html(MOCK_BANNER + ".") + "</body></html>", encoding="utf-8")
|
| 86 |
pdf = html_to_pdf(bundle, out / "go-no-go.pdf")
|
| 87 |
+
h.write_text(h.read_text(encoding="utf-8").replace("<body>", "<body>" + brand.header_html(), 1).replace("</body>", brand.footer_html(MOCK_BANNER + ".") + "</body>"), encoding="utf-8")
|
| 88 |
summ = {"run_id": run_id, "module": m, "patch_id": state.get("patch_id"), "source": tri.get("source"),
|
| 89 |
"run_mode": tri.get("run_mode"), "target": MOCK_BANNER, "decision": s["decision"],
|
| 90 |
"decision_source": report_rule.DECISION_SOURCE,
|
coworker/graph/services.py
CHANGED
|
@@ -119,7 +119,10 @@ def build_services(cfg: Settings | None = None, transport=None, frontier_transpo
|
|
| 119 |
autonomy, users)
|
| 120 |
# AI model settings saved in the app (Settings > AI models) override the environment, here and in every process
|
| 121 |
from ..platform import llm_settings
|
| 122 |
-
if frontier_transport is None
|
| 123 |
-
llm_settings.
|
|
|
|
|
|
|
|
|
|
| 124 |
router.before_call = lambda: llm_settings.sync(svc)
|
| 125 |
return svc
|
|
|
|
| 119 |
autonomy, users)
|
| 120 |
# AI model settings saved in the app (Settings > AI models) override the environment, here and in every process
|
| 121 |
from ..platform import llm_settings
|
| 122 |
+
if frontier_transport is None:
|
| 123 |
+
if llm_settings.saved(svc):
|
| 124 |
+
llm_settings.apply(svc)
|
| 125 |
+
else:
|
| 126 |
+
llm_settings.apply_environment(svc)
|
| 127 |
router.before_call = lambda: llm_settings.sync(svc)
|
| 128 |
return svc
|
coworker/platform/assets/wordmark-horizontal-light.svg
ADDED
|
|
coworker/platform/brand.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""The product name and logo for documents (report HTML/PDF, Excel). The web app reads the name from /api/ready (product_name)."""
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import base64
|
| 5 |
+
import html as _html
|
| 6 |
+
from functools import lru_cache
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
from ..config import VERSION
|
| 10 |
+
|
| 11 |
+
NAME = "Trio Co-Worker"
|
| 12 |
+
LEGAL = "Trio Co-Worker is independent software. Oracle and Fusion are trademarks of Oracle Corporation."
|
| 13 |
+
_WORDMARK = Path(__file__).with_name("assets") / "wordmark-horizontal-light.svg"
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
@lru_cache(maxsize=1)
|
| 17 |
+
def wordmark_data_uri() -> str:
|
| 18 |
+
"""The horizontal wordmark as a data URI, so a report stays one self-contained file. Empty when the asset is missing."""
|
| 19 |
+
try:
|
| 20 |
+
return "data:image/svg+xml;base64," + base64.b64encode(_WORDMARK.read_bytes()).decode("ascii")
|
| 21 |
+
except OSError:
|
| 22 |
+
return ""
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def header_html() -> str:
|
| 26 |
+
uri = wordmark_data_uri()
|
| 27 |
+
logo = f"<img src='{uri}' alt='{NAME}' style='height:26px;display:block'>" if uri else f"<b>{NAME}</b>"
|
| 28 |
+
return f"<div style='display:flex;align-items:center;gap:12px;padding:0 0 10px;border-bottom:1px solid #d2d2d7;margin-bottom:12px'>{logo}</div>"
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def footer_html(note: str = "") -> str:
|
| 32 |
+
extra = f" {_html.escape(note)}" if note else ""
|
| 33 |
+
return (f"<p style='margin-top:24px;padding-top:8px;border-top:1px solid #d2d2d7;color:#636366;font-size:12px'>"
|
| 34 |
+
f"Generated by {NAME} v{_html.escape(VERSION)}.{extra} {_html.escape(LEGAL)}</p>")
|
coworker/platform/egress.py
CHANGED
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
| 5 |
|
| 6 |
import ipaddress
|
| 7 |
import json
|
|
|
|
| 8 |
from dataclasses import dataclass, field
|
| 9 |
from typing import Any, Literal
|
| 10 |
from urllib.parse import urlparse
|
|
@@ -22,6 +23,14 @@ class NotConfigured(RuntimeError):
|
|
| 22 |
pass
|
| 23 |
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
@dataclass
|
| 26 |
class FetchedDoc:
|
| 27 |
url: str
|
|
@@ -157,6 +166,44 @@ class EgressGate:
|
|
| 157 |
self._log_resp(kind, url.split("?", 1)[0], r, None)
|
| 158 |
return r
|
| 159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
# ------------------------------------------------------------ public web (research)
|
| 161 |
def web_fetch(self, url: str, *, run_id: str | None = None, max_bytes: int = 2_000_000) -> FetchedDoc:
|
| 162 |
self.kill.check("egress.web")
|
|
|
|
| 5 |
|
| 6 |
import ipaddress
|
| 7 |
import json
|
| 8 |
+
import re
|
| 9 |
from dataclasses import dataclass, field
|
| 10 |
from typing import Any, Literal
|
| 11 |
from urllib.parse import urlparse
|
|
|
|
| 23 |
pass
|
| 24 |
|
| 25 |
|
| 26 |
+
class ServiceTimeout(RuntimeError):
|
| 27 |
+
"""An external service did not answer in time (raised instead of httpx's exception)."""
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class ServiceUnreachable(RuntimeError):
|
| 31 |
+
"""An external service could not be reached: DNS, connection or TLS failure."""
|
| 32 |
+
|
| 33 |
+
|
| 34 |
@dataclass
|
| 35 |
class FetchedDoc:
|
| 36 |
url: str
|
|
|
|
| 166 |
self._log_resp(kind, url.split("?", 1)[0], r, None)
|
| 167 |
return r
|
| 168 |
|
| 169 |
+
# ------------------------------------------------------------ Hermes assistant (OpenAI-compatible /v1 API)
|
| 170 |
+
def hermes_request(self, method: Literal["GET", "POST"], path: str, *, key: str, json_body: dict | None = None,
|
| 171 |
+
session_id: str | None = None, log_body: Any = None, timeout: float = 120.0) -> httpx.Response:
|
| 172 |
+
"""One call to the configured Hermes Agent (Settings.hermes_url). https only, that host only, /v1/ paths only,
|
| 173 |
+
no redirects. The bearer key goes in a header and is never logged; `log_body` is what the audit records (the
|
| 174 |
+
caller passes a digest of the question, never its text). A body that contains a vault secret is refused.
|
| 175 |
+
Network failures surface as ServiceTimeout / ServiceUnreachable (callers never import httpx)."""
|
| 176 |
+
self.kill.check("egress.hermes")
|
| 177 |
+
base = re.sub(r"/v1/?$", "", (self.cfg.hermes_url or "").strip().rstrip("/"))
|
| 178 |
+
url = base + "/" + path.lstrip("/")
|
| 179 |
+
b, u = urlparse(base), urlparse(url)
|
| 180 |
+
if b.scheme != "https" or u.scheme != "https":
|
| 181 |
+
self._deny("hermes", "https is required for the Hermes assistant", url, None)
|
| 182 |
+
if not b.hostname or (u.scheme, u.hostname, u.port) != (b.scheme, b.hostname, b.port):
|
| 183 |
+
self._deny("hermes", f"host {u.hostname} is not the configured Hermes host {b.hostname}", url, None)
|
| 184 |
+
if method not in ("GET", "POST") or not u.path.startswith((b.path or "") + "/v1/") or ".." in u.path:
|
| 185 |
+
self._deny("hermes", f"{method} {u.path} is outside the Hermes /v1 API", url, None)
|
| 186 |
+
if json_body is not None and self.vault is not None:
|
| 187 |
+
self.redactor.add_secrets(self.vault.secret_values())
|
| 188 |
+
if any(l["kind"] == "secret" for l in self.redactor.find_leaks(json_body)):
|
| 189 |
+
self._deny("hermes", "refused: the message contains a stored secret", url, None)
|
| 190 |
+
clean = url.split("?", 1)[0]
|
| 191 |
+
self._log_req("hermes", method, clean, log_body, None, {"session": session_id})
|
| 192 |
+
headers = {"Authorization": f"Bearer {key}", "Accept": "application/json"}
|
| 193 |
+
if session_id:
|
| 194 |
+
headers["X-Hermes-Session-Id"] = session_id
|
| 195 |
+
try:
|
| 196 |
+
with self._client(timeout=timeout) as c:
|
| 197 |
+
r = c.request(method, url, json=json_body, headers=headers)
|
| 198 |
+
except httpx.TimeoutException as e:
|
| 199 |
+
self.audit.append("egress.hermes.error", actor="system", summary=f"timeout {clean}", payload={"error": type(e).__name__})
|
| 200 |
+
raise ServiceTimeout(f"no answer from Hermes within {timeout:.0f} s") from None
|
| 201 |
+
except httpx.HTTPError as e:
|
| 202 |
+
self.audit.append("egress.hermes.error", actor="system", summary=f"unreachable {clean}", payload={"error": type(e).__name__})
|
| 203 |
+
raise ServiceUnreachable(f"Hermes could not be reached ({type(e).__name__})") from None
|
| 204 |
+
self._log_resp("hermes", clean, r, None)
|
| 205 |
+
return r
|
| 206 |
+
|
| 207 |
# ------------------------------------------------------------ public web (research)
|
| 208 |
def web_fetch(self, url: str, *, run_id: str | None = None, max_bytes: int = 2_000_000) -> FetchedDoc:
|
| 209 |
self.kill.check("egress.web")
|
coworker/platform/hermes.py
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Hermes assistant: "Ask a question" answered by the Hermes Agent (Nous Research) on its own Space.
|
| 2 |
+
|
| 3 |
+
Hermes reads the app through its own limited service account (deploy/hermes); this module only forwards the person's
|
| 4 |
+
question to Hermes' OpenAI-compatible API (POST {hermes_url}/v1/chat/completions) and returns the answer.
|
| 5 |
+
|
| 6 |
+
- Off unless Settings.hermes_enabled (FPT_HERMES_ENABLED). Then the built-in chat stays in use and ask() answers
|
| 7 |
+
409 HERMES_OFF.
|
| 8 |
+
- The bearer key is a secret: vault HERMES_API_KEY (env FPT_SECRET_HERMES_API_KEY), never a setting.
|
| 9 |
+
- A conversation continues across turns through Hermes' X-Hermes-Session-Id header (history is kept by Hermes). The
|
| 10 |
+
id is ours: "fpt-u<user id>-<random>", so a person can only continue their own conversations.
|
| 11 |
+
- Every call goes through the egress gate (https, the Hermes host only, audited without the key and without the
|
| 12 |
+
question text: only its length and sha256)."""
|
| 13 |
+
from __future__ import annotations
|
| 14 |
+
|
| 15 |
+
import hashlib
|
| 16 |
+
import re
|
| 17 |
+
import secrets
|
| 18 |
+
import threading
|
| 19 |
+
import time
|
| 20 |
+
|
| 21 |
+
from .egress import EgressDenied, ServiceTimeout, ServiceUnreachable
|
| 22 |
+
from .killswitch import KillSwitchEngaged
|
| 23 |
+
|
| 24 |
+
MAX_QUESTION = 2000
|
| 25 |
+
MODEL = "hermes-agent"
|
| 26 |
+
STATUS_TTL_S = 60.0
|
| 27 |
+
SESSION_RE = re.compile(r"^fpt-u(\d+)-[0-9a-f]{16}$")
|
| 28 |
+
|
| 29 |
+
_rate_lock = threading.Lock()
|
| 30 |
+
_rate: dict[int, list[float]] = {}
|
| 31 |
+
_status_lock = threading.Lock()
|
| 32 |
+
_status_cache: dict[str, tuple[float, bool]] = {}
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class HermesError(Exception):
|
| 36 |
+
def __init__(self, status: int, code: str, detail: str, retry_after: int | None = None):
|
| 37 |
+
super().__init__(detail)
|
| 38 |
+
self.status, self.code, self.detail, self.retry_after = status, code, detail, retry_after
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def api_key(svc) -> str | None:
|
| 42 |
+
return (svc.vault.get("HERMES_API_KEY") if svc.vault else None) or None
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def configured(svc) -> bool:
|
| 46 |
+
return bool((svc.cfg.hermes_url or "").strip()) and bool(api_key(svc))
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def reset_caches() -> None:
|
| 50 |
+
"""Tests: forget rate-limit hits and the cached reachability."""
|
| 51 |
+
with _rate_lock:
|
| 52 |
+
_rate.clear()
|
| 53 |
+
with _status_lock:
|
| 54 |
+
_status_cache.clear()
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def check_rate(svc, user) -> None:
|
| 58 |
+
"""Sliding one-minute window per user (Settings.hermes_rate_per_minute)."""
|
| 59 |
+
limit, now = max(1, int(svc.cfg.hermes_rate_per_minute)), time.time()
|
| 60 |
+
with _rate_lock:
|
| 61 |
+
hits = [t for t in _rate.get(user.id, []) if now - t < 60]
|
| 62 |
+
if len(hits) >= limit:
|
| 63 |
+
_rate[user.id] = hits
|
| 64 |
+
raise HermesError(429, "RATE_LIMITED", f"Too many questions: at most {limit} per minute. Please wait a moment.",
|
| 65 |
+
retry_after=int(60 - (now - hits[0])) + 1)
|
| 66 |
+
hits.append(now)
|
| 67 |
+
_rate[user.id] = hits
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def _ready(svc) -> str:
|
| 71 |
+
"""The key, or a clear HermesError when Hermes is off or not configured."""
|
| 72 |
+
if not svc.cfg.hermes_enabled:
|
| 73 |
+
raise HermesError(409, "HERMES_OFF", "The Hermes assistant is turned off here; use the built-in chat.")
|
| 74 |
+
if not (svc.cfg.hermes_url or "").strip():
|
| 75 |
+
raise HermesError(503, "HERMES_NOT_CONFIGURED", "The Hermes assistant is not configured: FPT_HERMES_URL is not set.")
|
| 76 |
+
key = api_key(svc)
|
| 77 |
+
if not key:
|
| 78 |
+
raise HermesError(503, "HERMES_NOT_CONFIGURED",
|
| 79 |
+
"The Hermes assistant is not configured: the secret HERMES_API_KEY (FPT_SECRET_HERMES_API_KEY) is not set.")
|
| 80 |
+
return key
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def _call(svc, method: str, path: str, *, key: str, body: dict | None = None, session_id: str | None = None,
|
| 84 |
+
log_body=None, timeout: float):
|
| 85 |
+
try:
|
| 86 |
+
return svc.egress.hermes_request(method, path, key=key, json_body=body, session_id=session_id, log_body=log_body,
|
| 87 |
+
timeout=timeout)
|
| 88 |
+
except ServiceTimeout as e:
|
| 89 |
+
raise HermesError(504, "HERMES_TIMEOUT", f"Hermes did not answer in time ({timeout:.0f} s). Please try again.") from e
|
| 90 |
+
except ServiceUnreachable as e:
|
| 91 |
+
raise HermesError(502, "HERMES_UNREACHABLE", f"{e}. The Hermes Space may be starting or asleep; try again shortly.") from e
|
| 92 |
+
except KillSwitchEngaged as e:
|
| 93 |
+
raise HermesError(503, "KILL_SWITCH", "The kill switch is engaged: no outside calls are made.") from e
|
| 94 |
+
except EgressDenied as e:
|
| 95 |
+
raise HermesError(503, "HERMES_REFUSED", str(e)) from e
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def _hermes_message(r) -> str:
|
| 99 |
+
try:
|
| 100 |
+
err = r.json().get("error") or {}
|
| 101 |
+
msg = err.get("message") if isinstance(err, dict) else str(err)
|
| 102 |
+
except (ValueError, AttributeError):
|
| 103 |
+
msg = ""
|
| 104 |
+
return (msg or r.text or "")[:200]
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def ask(svc, user, question: str, conversation_id: str | None = None) -> dict:
|
| 108 |
+
"""Ask Hermes one question. Returns {answer, conversation_id, model}; raises HermesError with a clear code."""
|
| 109 |
+
key = _ready(svc)
|
| 110 |
+
q = (question or "").strip()
|
| 111 |
+
if not q or len(q) > MAX_QUESTION:
|
| 112 |
+
raise HermesError(422, "BAD_TEXT", f"A question needs 1 to {MAX_QUESTION} characters.")
|
| 113 |
+
if conversation_id:
|
| 114 |
+
m = SESSION_RE.match(conversation_id)
|
| 115 |
+
if not m or int(m.group(1)) != user.id: # someone else's conversation looks exactly like a missing one
|
| 116 |
+
raise HermesError(404, "NOT_FOUND", "conversation not found")
|
| 117 |
+
cid = conversation_id
|
| 118 |
+
else:
|
| 119 |
+
cid = f"fpt-u{user.id}-{secrets.token_hex(8)}"
|
| 120 |
+
check_rate(svc, user)
|
| 121 |
+
digest = {"question_sha256": hashlib.sha256(q.encode("utf-8")).hexdigest(), "question_chars": len(q),
|
| 122 |
+
"conversation": cid, "user": user.username}
|
| 123 |
+
body = {"model": MODEL, "messages": [{"role": "user", "content": q}], "stream": False}
|
| 124 |
+
r = _call(svc, "POST", "/v1/chat/completions", key=key, body=body, session_id=cid, log_body=digest,
|
| 125 |
+
timeout=float(svc.cfg.hermes_timeout_s or 120))
|
| 126 |
+
if r.status_code in (401, 403):
|
| 127 |
+
_remember(svc, False)
|
| 128 |
+
raise HermesError(502, "HERMES_KEY_REJECTED",
|
| 129 |
+
"Hermes refused the API key: HERMES_API_KEY here must equal API_SERVER_KEY on the Hermes Space.")
|
| 130 |
+
if r.status_code == 429:
|
| 131 |
+
raise HermesError(503, "HERMES_BUSY", "Hermes is busy right now. Please try again in a minute.")
|
| 132 |
+
if r.status_code != 200:
|
| 133 |
+
raise HermesError(502, "HERMES_ERROR", f"Hermes answered {r.status_code}: {_hermes_message(r)}".rstrip(": "))
|
| 134 |
+
try:
|
| 135 |
+
data = r.json()
|
| 136 |
+
answer = (data["choices"][0]["message"].get("content") or "").strip()
|
| 137 |
+
except (ValueError, KeyError, IndexError, TypeError, AttributeError) as e:
|
| 138 |
+
raise HermesError(502, "HERMES_ERROR", "Hermes sent an answer this app could not read.") from e
|
| 139 |
+
if not answer:
|
| 140 |
+
raise HermesError(502, "HERMES_EMPTY", "Hermes returned an empty answer. Please rephrase or try again.")
|
| 141 |
+
_remember(svc, True)
|
| 142 |
+
svc.audit.append("assistant.asked", actor=user.username, summary="hermes",
|
| 143 |
+
payload={**digest, "answer_chars": len(answer), "model": data.get("model")})
|
| 144 |
+
return {"answer": answer, "conversation_id": cid, "model": data.get("model") or MODEL}
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
def _remember(svc, ok: bool) -> None:
|
| 148 |
+
with _status_lock:
|
| 149 |
+
_status_cache[(svc.cfg.hermes_url or "").strip()] = (time.time(), ok)
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
def status(svc) -> dict:
|
| 153 |
+
"""{enabled, configured, reachable}. reachable is None unless enabled and configured; then it is whether GET
|
| 154 |
+
/v1/models answered 200 with our key, cached for STATUS_TTL_S (a real question also refreshes it)."""
|
| 155 |
+
enabled, conf = bool(svc.cfg.hermes_enabled), configured(svc)
|
| 156 |
+
if not (enabled and conf):
|
| 157 |
+
return {"enabled": enabled, "configured": conf, "reachable": None}
|
| 158 |
+
url = (svc.cfg.hermes_url or "").strip()
|
| 159 |
+
with _status_lock:
|
| 160 |
+
hit = _status_cache.get(url)
|
| 161 |
+
if hit and time.time() - hit[0] < STATUS_TTL_S:
|
| 162 |
+
return {"enabled": True, "configured": True, "reachable": hit[1]}
|
| 163 |
+
try:
|
| 164 |
+
r = _call(svc, "GET", "/v1/models", key=api_key(svc) or "", log_body={"probe": "status"}, timeout=10.0)
|
| 165 |
+
ok = r.status_code == 200
|
| 166 |
+
except HermesError:
|
| 167 |
+
ok = False
|
| 168 |
+
_remember(svc, ok)
|
| 169 |
+
return {"enabled": True, "configured": True, "reachable": ok}
|
coworker/platform/llm_settings.py
CHANGED
|
@@ -78,6 +78,19 @@ def apply(svc, values: dict | None = None) -> None:
|
|
| 78 |
svc.extra["llm_settings_version"] = svc.db.kv_get(KV_VERSION) or 0
|
| 79 |
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
def sync(svc) -> None:
|
| 82 |
"""Cheap check before a model call: re-apply if another process saved new settings."""
|
| 83 |
if (svc.db.kv_get(KV_VERSION) or 0) != svc.extra.get("llm_settings_version", 0):
|
|
|
|
| 78 |
svc.extra["llm_settings_version"] = svc.db.kv_get(KV_VERSION) or 0
|
| 79 |
|
| 80 |
|
| 81 |
+
def apply_environment(svc) -> bool:
|
| 82 |
+
"""Nothing saved in the app and the environment names an external model with its key: use it. Returns True when it did.
|
| 83 |
+
Anything saved in the app (even "off") wins, so an administrator's choice is never overridden."""
|
| 84 |
+
cfg = svc.cfg
|
| 85 |
+
if saved(svc) or not cfg.frontier_auto or cfg.llm_frontier != "off":
|
| 86 |
+
return False
|
| 87 |
+
base = (cfg.frontier_base_url or "").strip()
|
| 88 |
+
if not base.lower().startswith("https://") or not (cfg.frontier_model or "").strip() or not svc.vault.get(VAULT_KEY):
|
| 89 |
+
return False
|
| 90 |
+
apply(svc, {"llm_frontier": "frontier", "frontier_base_url": base.rstrip("/")})
|
| 91 |
+
return True
|
| 92 |
+
|
| 93 |
+
|
| 94 |
def sync(svc) -> None:
|
| 95 |
"""Cheap check before a model call: re-apply if another process saved new settings."""
|
| 96 |
if (svc.db.kv_get(KV_VERSION) or 0) != svc.extra.get("llm_settings_version", 0):
|
coworker/platform/migrations/008_schedule_cadence.sql
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- 008: monthly and quarterly schedules, and a schedule can name the pod and patch it tests
|
| 2 |
+
ALTER TABLE schedules ADD COLUMN day INTEGER;
|
| 3 |
+
ALTER TABLE schedules ADD COLUMN month INTEGER;
|
| 4 |
+
ALTER TABLE schedules ADD COLUMN pod_id INTEGER;
|
| 5 |
+
ALTER TABLE schedules ADD COLUMN patch_id TEXT;
|
coworker/platform/patchcycle.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Patch cycles: Oracle Fusion ships a quarterly update (named by year and quarter letter: 25D, 26A, 26B, 26C) and monthly
|
| 2 |
+
updates between them. The patch name on a test run is free text; this module only reads it, so the app can say which
|
| 3 |
+
cadence a patch belongs to and sort patches by how recently they were tested. web/src/runName.ts has the same rules."""
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import re
|
| 7 |
+
|
| 8 |
+
QUARTERLY = re.compile(r"^(\d{2})\s*-?\s*([A-D])$", re.I) # 26C
|
| 9 |
+
MONTHLY = re.compile(r"^(?:(20\d{2})[-/.](0[1-9]|1[0-2])|(\d{2})([A-D])[-_ ]?(?:M|MONTHLY)[-_ ]?(\d{1,2}))$", re.I) # 2026-10, 26C-M2
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def classify(patch_id: str | None) -> dict:
|
| 13 |
+
"""{"patch_id", "cadence": quarterly|monthly|other|none, "label"}"""
|
| 14 |
+
p = (patch_id or "").strip()
|
| 15 |
+
if not p:
|
| 16 |
+
return {"patch_id": "", "cadence": "none", "label": "No patch name"}
|
| 17 |
+
m = QUARTERLY.match(p)
|
| 18 |
+
if m:
|
| 19 |
+
q = m.group(2).upper()
|
| 20 |
+
return {"patch_id": p, "cadence": "quarterly", "label": f"{m.group(1)}{q} quarterly update"}
|
| 21 |
+
m = MONTHLY.match(p)
|
| 22 |
+
if m:
|
| 23 |
+
if m.group(1):
|
| 24 |
+
return {"patch_id": p, "cadence": "monthly", "label": f"{m.group(1)}-{m.group(2)} monthly update"}
|
| 25 |
+
return {"patch_id": p, "cadence": "monthly", "label": f"{m.group(3)}{m.group(4).upper()} monthly update {m.group(5)}"}
|
| 26 |
+
return {"patch_id": p, "cadence": "other", "label": p}
|
coworker/platform/pods.py
CHANGED
|
@@ -8,11 +8,13 @@ credential was set (module, by whom, when), never its value."""
|
|
| 8 |
from __future__ import annotations
|
| 9 |
|
| 10 |
import json
|
|
|
|
| 11 |
import re
|
| 12 |
from urllib.parse import urlparse
|
| 13 |
|
| 14 |
from .rundb import now_iso
|
| 15 |
|
|
|
|
| 16 |
ENVIRONMENTS = ("test", "uat", "dev", "sit")
|
| 17 |
_PROD_HOST = re.compile(r"(^|[.-])prod(uction)?([.-]|\d|$)", re.I)
|
| 18 |
|
|
@@ -50,6 +52,7 @@ class PodRegistry:
|
|
| 50 |
def __init__(self, db, vault, cfg, egress, audit):
|
| 51 |
self.db, self.vault, self.cfg, self.egress, self.audit = db, vault, cfg, egress, audit
|
| 52 |
self.ensure_default()
|
|
|
|
| 53 |
|
| 54 |
# ------------------------------------------------------------ records
|
| 55 |
def ensure_default(self) -> None:
|
|
@@ -60,11 +63,49 @@ class PodRegistry:
|
|
| 60 |
"notes": "The local mock app every pilot run targets. Not Oracle Fusion.",
|
| 61 |
"created_by": "system", "created_at": now_iso(), "updated_at": now_iso()})
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
def _row(self, r: dict) -> dict:
|
| 64 |
creds = self.db.q("SELECT module, set_by, set_at FROM pod_credentials WHERE pod_id=? ORDER BY module", (r["id"],))
|
| 65 |
mods = r["modules"] if isinstance(r["modules"], list) else json.loads(r["modules"] or "[]")
|
| 66 |
runnable, why = self.runnable(r)
|
| 67 |
-
return {**r, "modules": mods, "enabled": bool(r["enabled"]), "is_default": bool(r["is_default"]),
|
| 68 |
"last_check_ok": None if r["last_check_ok"] is None else bool(r["last_check_ok"]),
|
| 69 |
"credentials": creds, "runnable": runnable, "not_runnable_reason": why}
|
| 70 |
|
|
@@ -108,6 +149,8 @@ class PodRegistry:
|
|
| 108 |
changes = {k: v for k, v in data.items() if v is not None}
|
| 109 |
if cur["is_default"] and any(k in changes and changes[k] != cur[k] for k in ("kind", "base_url", "environment")):
|
| 110 |
raise PodError("DEFAULT_LOCKED", "the default mock pod's kind, URL and environment come from the server configuration")
|
|
|
|
|
|
|
| 111 |
merged = {**cur, **changes}
|
| 112 |
base = validate(merged["kind"], merged["base_url"], merged["environment"])
|
| 113 |
self.db.update("pods", "id", pod_id, name=merged["name"], kind=merged["kind"], base_url=base, environment=merged["environment"],
|
|
@@ -120,6 +163,9 @@ class PodRegistry:
|
|
| 120 |
cur = self.get(pod_id)
|
| 121 |
if cur["is_default"]:
|
| 122 |
raise PodError("DEFAULT_LOCKED", "the default mock pod cannot be deleted")
|
|
|
|
|
|
|
|
|
|
| 123 |
self.db.x("DELETE FROM pod_credentials WHERE pod_id=?", (pod_id,))
|
| 124 |
self.db.x("DELETE FROM pods WHERE id=?", (pod_id,))
|
| 125 |
self.audit.append("pod.deleted", actor=actor, summary=cur["name"], payload={"pod_id": pod_id})
|
|
@@ -134,7 +180,11 @@ class PodRegistry:
|
|
| 134 |
return self.get(pod_id)
|
| 135 |
|
| 136 |
def fusion_auth(self, pod_id: int) -> tuple[str, str] | None:
|
| 137 |
-
"""The test user of a Fusion pod
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
rows = self.db.q("SELECT module FROM pod_credentials WHERE pod_id=? ORDER BY CASE WHEN module IN ('AP','PAYABLES','ALL') THEN 0 ELSE 1 END, module", (pod_id,))
|
| 139 |
for r in rows:
|
| 140 |
raw = self.vault.get(f"pods.{pod_id}.{r['module'].lower()}")
|
|
|
|
| 8 |
from __future__ import annotations
|
| 9 |
|
| 10 |
import json
|
| 11 |
+
import logging
|
| 12 |
import re
|
| 13 |
from urllib.parse import urlparse
|
| 14 |
|
| 15 |
from .rundb import now_iso
|
| 16 |
|
| 17 |
+
log = logging.getLogger("fpt.pods")
|
| 18 |
ENVIRONMENTS = ("test", "uat", "dev", "sit")
|
| 19 |
_PROD_HOST = re.compile(r"(^|[.-])prod(uction)?([.-]|\d|$)", re.I)
|
| 20 |
|
|
|
|
| 52 |
def __init__(self, db, vault, cfg, egress, audit):
|
| 53 |
self.db, self.vault, self.cfg, self.egress, self.audit = db, vault, cfg, egress, audit
|
| 54 |
self.ensure_default()
|
| 55 |
+
self.ensure_from_env()
|
| 56 |
|
| 57 |
# ------------------------------------------------------------ records
|
| 58 |
def ensure_default(self) -> None:
|
|
|
|
| 63 |
"notes": "The local mock app every pilot run targets. Not Oracle Fusion.",
|
| 64 |
"created_by": "system", "created_at": now_iso(), "updated_at": now_iso()})
|
| 65 |
|
| 66 |
+
def env_auth(self) -> tuple[str, str] | None:
|
| 67 |
+
"""The test user of the pod defined by the environment (secrets FUSION_USERNAME / FUSION_PASSWORD), if both are set."""
|
| 68 |
+
u, p = self.vault.get("FUSION_USERNAME"), self.vault.get("FUSION_PASSWORD")
|
| 69 |
+
return (u, p) if u and p else None
|
| 70 |
+
|
| 71 |
+
def is_env_pod(self, r: dict) -> bool:
|
| 72 |
+
url = (self.cfg.fusion_base_url or "").strip()
|
| 73 |
+
return bool(url) and r["kind"] == "fusion" and norm_url(r["base_url"]) == norm_url(url)
|
| 74 |
+
|
| 75 |
+
def ensure_from_env(self) -> None:
|
| 76 |
+
"""FPT_FUSION_BASE_URL: make sure that Fusion test pod is registered (matched by address, so a pod the person already
|
| 77 |
+
registered or restored is kept as it is) and that it has a test user when the secrets hold one. Idempotent."""
|
| 78 |
+
url = (self.cfg.fusion_base_url or "").strip()
|
| 79 |
+
if not url:
|
| 80 |
+
return
|
| 81 |
+
try:
|
| 82 |
+
base = validate("fusion", url, self.cfg.fusion_environment)
|
| 83 |
+
except PodError as e:
|
| 84 |
+
log.warning("FPT_FUSION_BASE_URL ignored: %s", e)
|
| 85 |
+
return
|
| 86 |
+
row = self.db.one("SELECT id FROM pods WHERE kind='fusion' AND base_url=?", (base,))
|
| 87 |
+
if row:
|
| 88 |
+
pid = row["id"]
|
| 89 |
+
else:
|
| 90 |
+
name = self.cfg.fusion_name.strip() or "Oracle Fusion test pod"
|
| 91 |
+
if self.db.one("SELECT id FROM pods WHERE name=?", (name,)):
|
| 92 |
+
name = f"{name} ({urlparse(base).hostname})"
|
| 93 |
+
pid = self.db.insert("pods", {"name": name, "kind": "fusion", "base_url": base, "environment": self.cfg.fusion_environment,
|
| 94 |
+
"modules": [m.upper() for m in self.cfg.fusion_modules], "enabled": 1, "is_default": 0,
|
| 95 |
+
"notes": "Created from the server settings (FPT_FUSION_BASE_URL), so it survives a restart.",
|
| 96 |
+
"created_by": "system", "created_at": now_iso(), "updated_at": now_iso()})
|
| 97 |
+
self.audit.append("pod.created", actor="system", summary=f"{name} (fusion, {self.cfg.fusion_environment}) {base} from the server settings",
|
| 98 |
+
payload={"pod_id": pid, "kind": "fusion", "base_url": base, "environment": self.cfg.fusion_environment})
|
| 99 |
+
if self.env_auth() and not self.db.one("SELECT 1 AS x FROM pod_credentials WHERE pod_id=?", (pid,)):
|
| 100 |
+
# the user and password stay in the secrets; this row only records that the pod has a test user
|
| 101 |
+
self.db.x("INSERT OR REPLACE INTO pod_credentials (pod_id, module, set_by, set_at) VALUES (?,?,?,?)", (pid, "ALL", "system", now_iso()))
|
| 102 |
+
self.audit.append("pod.credential_set", actor="system", summary=f"pod {pid} ALL (from the server secrets)", payload={"pod_id": pid, "module": "ALL"})
|
| 103 |
+
|
| 104 |
def _row(self, r: dict) -> dict:
|
| 105 |
creds = self.db.q("SELECT module, set_by, set_at FROM pod_credentials WHERE pod_id=? ORDER BY module", (r["id"],))
|
| 106 |
mods = r["modules"] if isinstance(r["modules"], list) else json.loads(r["modules"] or "[]")
|
| 107 |
runnable, why = self.runnable(r)
|
| 108 |
+
return {**r, "modules": mods, "from_server_settings": self.is_env_pod(r), "enabled": bool(r["enabled"]), "is_default": bool(r["is_default"]),
|
| 109 |
"last_check_ok": None if r["last_check_ok"] is None else bool(r["last_check_ok"]),
|
| 110 |
"credentials": creds, "runnable": runnable, "not_runnable_reason": why}
|
| 111 |
|
|
|
|
| 149 |
changes = {k: v for k, v in data.items() if v is not None}
|
| 150 |
if cur["is_default"] and any(k in changes and changes[k] != cur[k] for k in ("kind", "base_url", "environment")):
|
| 151 |
raise PodError("DEFAULT_LOCKED", "the default mock pod's kind, URL and environment come from the server configuration")
|
| 152 |
+
if cur["from_server_settings"] and any(k in changes and changes[k] != cur[k] for k in ("kind", "base_url", "environment")):
|
| 153 |
+
raise PodError("FROM_SETTINGS", "this pod's kind, address and environment come from the server settings (FPT_FUSION_BASE_URL)")
|
| 154 |
merged = {**cur, **changes}
|
| 155 |
base = validate(merged["kind"], merged["base_url"], merged["environment"])
|
| 156 |
self.db.update("pods", "id", pod_id, name=merged["name"], kind=merged["kind"], base_url=base, environment=merged["environment"],
|
|
|
|
| 163 |
cur = self.get(pod_id)
|
| 164 |
if cur["is_default"]:
|
| 165 |
raise PodError("DEFAULT_LOCKED", "the default mock pod cannot be deleted")
|
| 166 |
+
if cur["from_server_settings"]:
|
| 167 |
+
raise PodError("FROM_SETTINGS", "this pod comes from the server settings (FPT_FUSION_BASE_URL) and would be created again at the next start. "
|
| 168 |
+
"Disable it instead, or remove that setting to remove the pod.", 409)
|
| 169 |
self.db.x("DELETE FROM pod_credentials WHERE pod_id=?", (pod_id,))
|
| 170 |
self.db.x("DELETE FROM pods WHERE id=?", (pod_id,))
|
| 171 |
self.audit.append("pod.deleted", actor=actor, summary=cur["name"], payload={"pod_id": pod_id})
|
|
|
|
| 180 |
return self.get(pod_id)
|
| 181 |
|
| 182 |
def fusion_auth(self, pod_id: int) -> tuple[str, str] | None:
|
| 183 |
+
"""The test user of a Fusion pod: the server secrets for the pod defined in the environment, else from the vault
|
| 184 |
+
(the Payables credential if set, else the first one)."""
|
| 185 |
+
pod = self.db.one("SELECT * FROM pods WHERE id=?", (pod_id,))
|
| 186 |
+
if pod and self.is_env_pod(pod) and self.env_auth():
|
| 187 |
+
return self.env_auth()
|
| 188 |
rows = self.db.q("SELECT module FROM pod_credentials WHERE pod_id=? ORDER BY CASE WHEN module IN ('AP','PAYABLES','ALL') THEN 0 ELSE 1 END, module", (pod_id,))
|
| 189 |
for r in rows:
|
| 190 |
raw = self.vault.get(f"pods.{pod_id}.{r['module'].lower()}")
|
coworker/platform/readiness.py
CHANGED
|
@@ -406,8 +406,10 @@ def readiness(svc, runs_mgr, pod_id: int | None, patch_id: str | None, modules:
|
|
| 406 |
st = runs_mgr.state(r["run_id"]) if r else None
|
| 407 |
gate = runs_mgr.gate_payload(r["run_id"]) if r and r.get("pending_gate") else None
|
| 408 |
out.append(module_readiness(m, r, st, gate))
|
| 409 |
-
|
| 410 |
-
|
|
|
|
|
|
|
| 411 |
"legend": {"failing": "Failing", "gap": "No coverage (gap)", "not_tested": "Affected, not yet tested",
|
| 412 |
"passed": "Affected and passed", "not_affected": "Not affected by the patch"},
|
| 413 |
"target": "Mock app, not Oracle Fusion"}
|
|
|
|
| 406 |
st = runs_mgr.state(r["run_id"]) if r else None
|
| 407 |
gate = runs_mgr.gate_payload(r["run_id"]) if r and r.get("pending_gate") else None
|
| 408 |
out.append(module_readiness(m, r, st, gate))
|
| 409 |
+
# newest test run first: "the latest patch" is the one tested most recently, whatever its name (26C, 2026-10, ...)
|
| 410 |
+
patches = list(dict.fromkeys(r["patch_id"] for r in latest_runs(svc, pod_id, None) if r.get("patch_id")))
|
| 411 |
+
from .patchcycle import classify
|
| 412 |
+
return {"pod_id": pod_id, "patch_id": patch_id, "patches": patches, "patch_cycles": [classify(p) for p in patches], "modules": out,
|
| 413 |
"legend": {"failing": "Failing", "gap": "No coverage (gap)", "not_tested": "Affected, not yet tested",
|
| 414 |
"passed": "Affected and passed", "not_affected": "Not affected by the patch"},
|
| 415 |
"target": "Mock app, not Oracle Fusion"}
|
coworker/platform/scheduler.py
CHANGED
|
@@ -18,10 +18,45 @@ def _parse(ts: str | None) -> datetime | None:
|
|
| 18 |
return datetime.fromisoformat(ts)
|
| 19 |
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
def next_run(s: dict, after: datetime) -> datetime:
|
| 22 |
if s["kind"] == "interval":
|
| 23 |
return after + timedelta(minutes=max(1, int(s.get("every_minutes") or 60)))
|
| 24 |
hh, mm = (str(s.get("at") or "02:00").split(":") + ["0"])[:2]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
cand = after.replace(hour=int(hh), minute=int(mm), second=0, microsecond=0)
|
| 26 |
return cand if cand > after else cand + timedelta(days=1)
|
| 27 |
|
|
@@ -79,8 +114,7 @@ class Scheduler:
|
|
| 79 |
self.svc.db.update("schedules", "id", s["id"], next_run_at=next_run(s, now).isoformat(timespec="seconds"))
|
| 80 |
continue
|
| 81 |
if due <= now:
|
| 82 |
-
rid = self.runs.start(
|
| 83 |
-
"playwright_mode": s["playwright_mode"]}, actor=f"schedule:{s['id']}", trigger="schedule")
|
| 84 |
out["started"].append(rid)
|
| 85 |
self.svc.db.update("schedules", "id", s["id"], next_run_at=next_run(s, now).isoformat(timespec="seconds"))
|
| 86 |
pw = self.patch_watch()
|
|
@@ -115,7 +149,8 @@ class Scheduler:
|
|
| 115 |
def create(self, rec: dict, actor: str) -> dict:
|
| 116 |
row = {"kind": rec["kind"], "every_minutes": rec.get("every_minutes"), "at": rec.get("at"), "modules": rec.get("modules") or [],
|
| 117 |
"include_p2": int(bool(rec.get("include_p2"))), "playwright_mode": rec.get("playwright_mode") or "live",
|
| 118 |
-
"enabled": int(rec.get("enabled", True)), "created_by": actor, "created_at": now_iso()
|
|
|
|
| 119 |
row["next_run_at"] = next_run(row, datetime.now(timezone.utc)).isoformat(timespec="seconds")
|
| 120 |
sid = self.svc.db.insert("schedules", row)
|
| 121 |
return self.get(sid) # type: ignore[return-value]
|
|
|
|
| 18 |
return datetime.fromisoformat(ts)
|
| 19 |
|
| 20 |
|
| 21 |
+
def run_inputs(s: dict) -> dict:
|
| 22 |
+
"""What a due schedule hands to the run manager (shared by the in-process scheduler and the Temporal activity)."""
|
| 23 |
+
out = {"modules": s["modules"], "include_p2": bool(s["include_p2"]), "playwright_mode": s["playwright_mode"]}
|
| 24 |
+
if s.get("pod_id"):
|
| 25 |
+
out["pod_id"] = s["pod_id"]
|
| 26 |
+
if s.get("patch_id"):
|
| 27 |
+
out["patch_id"] = s["patch_id"]
|
| 28 |
+
return out
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def months_of(s: dict) -> list[int]:
|
| 32 |
+
"""Calendar months a monthly (every month) or quarterly (every third month, from `month`) schedule runs in."""
|
| 33 |
+
if s["kind"] == "monthly":
|
| 34 |
+
return list(range(1, 13))
|
| 35 |
+
first = int(s.get("month") or 1)
|
| 36 |
+
return sorted({(first - 1 + 3 * i) % 12 + 1 for i in range(4)})
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def cron_of(s: dict) -> str:
|
| 40 |
+
hh, mm = (str(s.get("at") or "02:00").split(":") + ["0"])[:2]
|
| 41 |
+
if s["kind"] in ("monthly", "quarterly"):
|
| 42 |
+
months = "*" if s["kind"] == "monthly" else ",".join(str(m) for m in months_of(s))
|
| 43 |
+
return f"{int(mm)} {int(hh)} {int(s.get('day') or 1)} {months} *"
|
| 44 |
+
return f"{int(mm)} {int(hh)} * * *"
|
| 45 |
+
|
| 46 |
+
|
| 47 |
def next_run(s: dict, after: datetime) -> datetime:
|
| 48 |
if s["kind"] == "interval":
|
| 49 |
return after + timedelta(minutes=max(1, int(s.get("every_minutes") or 60)))
|
| 50 |
hh, mm = (str(s.get("at") or "02:00").split(":") + ["0"])[:2]
|
| 51 |
+
if s["kind"] in ("monthly", "quarterly"): # day 1-28 of the chosen months, at the given UTC time
|
| 52 |
+
day, months = min(28, max(1, int(s.get("day") or 1))), months_of(s)
|
| 53 |
+
y, m = after.year, after.month
|
| 54 |
+
for _ in range(25):
|
| 55 |
+
cand = after.replace(year=y, month=m, day=day, hour=int(hh), minute=int(mm), second=0, microsecond=0)
|
| 56 |
+
if m in months and cand > after:
|
| 57 |
+
return cand
|
| 58 |
+
y, m = (y + 1, 1) if m == 12 else (y, m + 1)
|
| 59 |
+
raise ValueError("no next run found")
|
| 60 |
cand = after.replace(hour=int(hh), minute=int(mm), second=0, microsecond=0)
|
| 61 |
return cand if cand > after else cand + timedelta(days=1)
|
| 62 |
|
|
|
|
| 114 |
self.svc.db.update("schedules", "id", s["id"], next_run_at=next_run(s, now).isoformat(timespec="seconds"))
|
| 115 |
continue
|
| 116 |
if due <= now:
|
| 117 |
+
rid = self.runs.start(run_inputs(s), actor=f"schedule:{s['id']}", trigger="schedule")
|
|
|
|
| 118 |
out["started"].append(rid)
|
| 119 |
self.svc.db.update("schedules", "id", s["id"], next_run_at=next_run(s, now).isoformat(timespec="seconds"))
|
| 120 |
pw = self.patch_watch()
|
|
|
|
| 149 |
def create(self, rec: dict, actor: str) -> dict:
|
| 150 |
row = {"kind": rec["kind"], "every_minutes": rec.get("every_minutes"), "at": rec.get("at"), "modules": rec.get("modules") or [],
|
| 151 |
"include_p2": int(bool(rec.get("include_p2"))), "playwright_mode": rec.get("playwright_mode") or "live",
|
| 152 |
+
"enabled": int(rec.get("enabled", True)), "created_by": actor, "created_at": now_iso(),
|
| 153 |
+
"day": rec.get("day"), "month": rec.get("month"), "pod_id": rec.get("pod_id"), "patch_id": (rec.get("patch_id") or None)}
|
| 154 |
row["next_run_at"] = next_run(row, datetime.now(timezone.utc)).isoformat(timespec="seconds")
|
| 155 |
sid = self.svc.db.insert("schedules", row)
|
| 156 |
return self.get(sid) # type: ignore[return-value]
|
coworker/platform/statesync.py
CHANGED
|
@@ -28,6 +28,8 @@ from .rundb import now_iso
|
|
| 28 |
|
| 29 |
log = logging.getLogger("fpt.statesync")
|
| 30 |
OBJECT, META = "state/latest.bin", "state/meta.json"
|
|
|
|
|
|
|
| 31 |
DATABASES = ("fpt.sqlite", "checkpoints.sqlite")
|
| 32 |
FOLDERS = ("secrets", "runs", "evidence", "tickets")
|
| 33 |
MAX_BYTES = 45 * 1024 * 1024 # Supabase's free plan rejects objects above 50 MB
|
|
@@ -89,9 +91,19 @@ def build_archive(home: Path, include_evidence: bool = True) -> bytes:
|
|
| 89 |
return buf.getvalue()
|
| 90 |
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
def push(svc, reason: str = "changed") -> dict:
|
| 93 |
client = sb.of(svc)
|
| 94 |
home = svc.cfg.home
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
data = build_archive(home)
|
| 96 |
note = ""
|
| 97 |
if len(data) > MAX_BYTES:
|
|
@@ -107,6 +119,40 @@ def push(svc, reason: str = "changed") -> dict:
|
|
| 107 |
return meta
|
| 108 |
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
def restore(svc_or_cfg, client: sb.Supabase | None = None, force: bool = False) -> bool:
|
| 111 |
"""Download and unpack the archive when this instance has no data yet. Returns True when data was restored."""
|
| 112 |
cfg = getattr(svc_or_cfg, "cfg", svc_or_cfg)
|
|
|
|
| 28 |
|
| 29 |
log = logging.getLogger("fpt.statesync")
|
| 30 |
OBJECT, META = "state/latest.bin", "state/meta.json"
|
| 31 |
+
PREVIOUS = "state/previous.bin" # the archive that was in the bucket when this process made its first save
|
| 32 |
+
FAILED_MARKER = ".state-restore-failed" # written at boot when the saved state could not be read; blocks saving
|
| 33 |
DATABASES = ("fpt.sqlite", "checkpoints.sqlite")
|
| 34 |
FOLDERS = ("secrets", "runs", "evidence", "tickets")
|
| 35 |
MAX_BYTES = 45 * 1024 * 1024 # Supabase's free plan rejects objects above 50 MB
|
|
|
|
| 91 |
return buf.getvalue()
|
| 92 |
|
| 93 |
|
| 94 |
+
def restore_failed(home: Path | str) -> bool:
|
| 95 |
+
return (Path(home) / FAILED_MARKER).exists()
|
| 96 |
+
|
| 97 |
+
|
| 98 |
def push(svc, reason: str = "changed") -> dict:
|
| 99 |
client = sb.of(svc)
|
| 100 |
home = svc.cfg.home
|
| 101 |
+
if restore_failed(home):
|
| 102 |
+
# Starting empty because the saved state could not be read must never replace that saved state with nothing.
|
| 103 |
+
raise sb.SupabaseError("STATE_RESTORE_FAILED", "saving is paused: the saved state could not be read when this instance started. "
|
| 104 |
+
"Restart the instance to try again.", 503)
|
| 105 |
+
if "state_signature" not in svc.extra:
|
| 106 |
+
_keep_previous(client)
|
| 107 |
data = build_archive(home)
|
| 108 |
note = ""
|
| 109 |
if len(data) > MAX_BYTES:
|
|
|
|
| 119 |
return meta
|
| 120 |
|
| 121 |
|
| 122 |
+
def _keep_previous(client: sb.Supabase) -> None:
|
| 123 |
+
"""First save of this process: keep a copy of what the bucket holds now, so one bad save can always be undone by hand
|
| 124 |
+
(copy state/previous.bin back over state/latest.bin). Best effort: a failure here never stops the save."""
|
| 125 |
+
try:
|
| 126 |
+
old = client.download(OBJECT)
|
| 127 |
+
if old:
|
| 128 |
+
client.ensure_bucket()
|
| 129 |
+
client.upload(PREVIOUS, old)
|
| 130 |
+
except Exception as e: # noqa: BLE001
|
| 131 |
+
log.warning("could not keep the previous state archive: %s", e)
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
def restore_at_boot(cfg, client: sb.Supabase, attempts: int = 4, wait_s: float = 3.0, sleep=None) -> tuple[bool, str | None]:
|
| 135 |
+
"""The start-up restore: retries a few times (the network may not be up yet) and, when the saved state still cannot be
|
| 136 |
+
read, writes FAILED_MARKER so this instance (which then starts empty) does not overwrite the saved state.
|
| 137 |
+
Returns (restored, error). 'No saved state yet' is not an error."""
|
| 138 |
+
import time
|
| 139 |
+
sleep = sleep or time.sleep
|
| 140 |
+
home = Path(cfg.home)
|
| 141 |
+
(home / FAILED_MARKER).unlink(missing_ok=True) # a marker from an earlier start on a persistent disk is stale
|
| 142 |
+
err = ""
|
| 143 |
+
for i in range(max(1, attempts)):
|
| 144 |
+
try:
|
| 145 |
+
return restore(cfg, client), None
|
| 146 |
+
except Exception as e: # noqa: BLE001 - network, storage and key problems all end the same way
|
| 147 |
+
err = f"{type(e).__name__}: {str(e)[:200]}"
|
| 148 |
+
log.warning("state restore attempt %d failed: %s", i + 1, err)
|
| 149 |
+
if i + 1 < attempts:
|
| 150 |
+
sleep(wait_s * (i + 1))
|
| 151 |
+
home.mkdir(parents=True, exist_ok=True)
|
| 152 |
+
(home / FAILED_MARKER).write_text(err, encoding="utf-8")
|
| 153 |
+
return False, err
|
| 154 |
+
|
| 155 |
+
|
| 156 |
def restore(svc_or_cfg, client: sb.Supabase | None = None, force: bool = False) -> bool:
|
| 157 |
"""Download and unpack the archive when this instance has no data yet. Returns True when data was restored."""
|
| 158 |
cfg = getattr(svc_or_cfg, "cfg", svc_or_cfg)
|
coworker/platform/test_script.py
CHANGED
|
@@ -54,6 +54,7 @@ def build(run: dict, scenarios: list[dict], failures: list[dict], *, area_names:
|
|
| 54 |
# business order: by area, then the process flow (Requisition before Purchase order...), then scenario id
|
| 55 |
scenarios = sorted(scenarios, key=lambda x: (x.get("module") or "", order.get(x.get("step") or "", 999), x.get("step") or "~", x["id"]))
|
| 56 |
wb = Workbook()
|
|
|
|
| 57 |
|
| 58 |
# ---- Read me
|
| 59 |
ws = wb.active
|
|
@@ -62,7 +63,7 @@ def build(run: dict, scenarios: list[dict], failures: list[dict], *, area_names:
|
|
| 62 |
ws.column_dimensions["B"].width = 96
|
| 63 |
areas = sorted({s.get("module") or "" for s in scenarios})
|
| 64 |
rows = [
|
| 65 |
-
("Test script", "
|
| 66 |
("Test run", run.get("run_id")),
|
| 67 |
("Test environment", (run.get("inputs") or {}).get("pod_name") if isinstance(run.get("inputs"), dict) else None),
|
| 68 |
("Patch", run.get("patch_id") or "the release the pod reports"),
|
|
|
|
| 54 |
# business order: by area, then the process flow (Requisition before Purchase order...), then scenario id
|
| 55 |
scenarios = sorted(scenarios, key=lambda x: (x.get("module") or "", order.get(x.get("step") or "", 999), x.get("step") or "~", x["id"]))
|
| 56 |
wb = Workbook()
|
| 57 |
+
wb.properties.creator = "Trio Co-Worker"
|
| 58 |
|
| 59 |
# ---- Read me
|
| 60 |
ws = wb.active
|
|
|
|
| 63 |
ws.column_dimensions["B"].width = 96
|
| 64 |
areas = sorted({s.get("module") or "" for s in scenarios})
|
| 65 |
rows = [
|
| 66 |
+
("Test script", "Trio Co-Worker"),
|
| 67 |
("Test run", run.get("run_id")),
|
| 68 |
("Test environment", (run.get("inputs") or {}).get("pod_name") if isinstance(run.get("inputs"), dict) else None),
|
| 69 |
("Patch", run.get("patch_id") or "the release the pod reports"),
|
coworker/tests/test_brand.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""The product is "Trio Co-Worker": default name, API docs title, and the report header and footer."""
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import unittest
|
| 5 |
+
|
| 6 |
+
from coworker.config import Settings, VERSION
|
| 7 |
+
from coworker.platform import brand
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class TestBrand(unittest.TestCase):
|
| 11 |
+
def test_default_product_name(self):
|
| 12 |
+
self.assertEqual(Settings().product_name, "Trio Co-Worker")
|
| 13 |
+
|
| 14 |
+
def test_report_header_has_the_wordmark_as_a_data_uri(self):
|
| 15 |
+
h = brand.header_html()
|
| 16 |
+
self.assertIn("data:image/svg+xml;base64,", h) # one self-contained file: no external logo request
|
| 17 |
+
self.assertIn("alt='Trio Co-Worker'", h)
|
| 18 |
+
|
| 19 |
+
def test_report_footer_names_the_product_version_and_the_legal_line(self):
|
| 20 |
+
f = brand.footer_html("Mock app, not Oracle Fusion.")
|
| 21 |
+
self.assertIn(f"Generated by Trio Co-Worker v{VERSION}", f)
|
| 22 |
+
self.assertIn("Mock app, not Oracle Fusion.", f)
|
| 23 |
+
self.assertIn("Oracle and Fusion are trademarks of Oracle Corporation", f)
|
| 24 |
+
|
| 25 |
+
def test_the_api_docs_carry_the_name(self):
|
| 26 |
+
import json
|
| 27 |
+
from coworker.config import ROOT
|
| 28 |
+
spec = json.loads((ROOT / "web" / "src" / "api" / "openapi.json").read_text(encoding="utf-8"))
|
| 29 |
+
self.assertEqual(spec["info"]["title"], "Trio Co-Worker API")
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
if __name__ == "__main__":
|
| 33 |
+
unittest.main()
|
coworker/tests/test_cadence.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Monthly and quarterly patch cycles: patch names are read as cycles, schedules can repeat monthly or quarterly on a chosen
|
| 2 |
+
pod and patch, and the newest tested patch is the 'latest' one whatever its name."""
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
import unittest
|
| 6 |
+
from datetime import datetime, timezone
|
| 7 |
+
|
| 8 |
+
from coworker.platform import scheduler as S
|
| 9 |
+
from coworker.platform.patchcycle import classify
|
| 10 |
+
from coworker.tests.fakes import bearer, make_app
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def utc(y, m, d, hh=0, mm=0):
|
| 14 |
+
return datetime(y, m, d, hh, mm, tzinfo=timezone.utc)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class TestPatchCycle(unittest.TestCase):
|
| 18 |
+
def test_names_are_read_as_quarterly_or_monthly(self):
|
| 19 |
+
self.assertEqual(classify("26C")["cadence"], "quarterly")
|
| 20 |
+
self.assertEqual(classify("26c")["label"], "26C quarterly update")
|
| 21 |
+
self.assertEqual(classify("2026-10")["cadence"], "monthly")
|
| 22 |
+
self.assertEqual(classify("26C-M2")["label"], "26C monthly update 2")
|
| 23 |
+
self.assertEqual(classify("hotfix 7")["cadence"], "other")
|
| 24 |
+
self.assertEqual(classify(None)["cadence"], "none")
|
| 25 |
+
self.assertEqual(classify("2026-13")["cadence"], "other")
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class TestSchedules(unittest.TestCase):
|
| 29 |
+
def test_monthly_next_run_and_cron(self):
|
| 30 |
+
s = {"kind": "monthly", "day": 5, "at": "02:30"}
|
| 31 |
+
self.assertEqual(S.next_run(s, utc(2026, 10, 24)), utc(2026, 11, 5, 2, 30))
|
| 32 |
+
self.assertEqual(S.next_run(s, utc(2026, 10, 3)), utc(2026, 10, 5, 2, 30))
|
| 33 |
+
self.assertEqual(S.next_run(s, utc(2026, 12, 20)), utc(2027, 1, 5, 2, 30))
|
| 34 |
+
self.assertEqual(S.cron_of(s), "30 2 5 * *")
|
| 35 |
+
|
| 36 |
+
def test_quarterly_runs_every_third_month_from_the_first(self):
|
| 37 |
+
s = {"kind": "quarterly", "day": 10, "at": "03:00", "month": 2}
|
| 38 |
+
self.assertEqual(S.months_of(s), [2, 5, 8, 11])
|
| 39 |
+
self.assertEqual(S.next_run(s, utc(2026, 10, 24)), utc(2026, 11, 10, 3))
|
| 40 |
+
self.assertEqual(S.next_run(s, utc(2026, 11, 11)), utc(2027, 2, 10, 3))
|
| 41 |
+
self.assertEqual(S.cron_of(s), "0 3 10 2,5,8,11 *")
|
| 42 |
+
self.assertEqual(S.months_of({"kind": "quarterly", "month": 12}), [3, 6, 9, 12])
|
| 43 |
+
|
| 44 |
+
def test_api_validates_and_a_due_schedule_starts_a_run_on_its_pod_and_patch(self):
|
| 45 |
+
app, c, svc, _ = make_app()
|
| 46 |
+
h = bearer(c, "admin")
|
| 47 |
+
for body in ({"kind": "monthly", "playwright_mode": "stub"}, {"kind": "quarterly", "day": 3, "at": "02:00", "playwright_mode": "stub"},
|
| 48 |
+
{"kind": "monthly", "day": 3, "at": "02:00", "pod_id": 999, "playwright_mode": "stub"}):
|
| 49 |
+
self.assertEqual(c.post("/api/schedules", json=body, headers=h).status_code, 422, body)
|
| 50 |
+
pod = [p for p in c.get("/api/pods", headers=h).json() if p["is_default"]][0]
|
| 51 |
+
r = c.post("/api/schedules", json={"kind": "quarterly", "day": 3, "at": "02:00", "month": 2, "modules": ["P2P"], "playwright_mode": "stub",
|
| 52 |
+
"pod_id": pod["id"], "patch_id": "26C"}, headers=h)
|
| 53 |
+
self.assertEqual(r.status_code, 201, r.text)
|
| 54 |
+
s = r.json()
|
| 55 |
+
self.assertEqual((s["kind"], s["day"], s["month"], s["pod_id"], s["patch_id"]), ("quarterly", 3, 2, pod["id"], "26C"))
|
| 56 |
+
self.assertGreater(S._parse(s["next_run_at"]), datetime.now(timezone.utc))
|
| 57 |
+
svc.db.update("schedules", "id", s["id"], next_run_at="2000-01-01T00:00:00+00:00")
|
| 58 |
+
out = app.state.scheduler.tick(datetime.now(timezone.utc))
|
| 59 |
+
self.assertEqual(len(out["started"]), 1)
|
| 60 |
+
run = c.get(f"/api/runs/{out['started'][0]}", headers=h).json()
|
| 61 |
+
self.assertEqual((run["patch_id"], run["pod_id"], run["trigger"]), ("26C", pod["id"], "schedule"))
|
| 62 |
+
app.state.runs.cancel(out["started"][0], "test")
|
| 63 |
+
|
| 64 |
+
def test_readiness_lists_the_most_recently_tested_patch_first_with_its_cycle(self):
|
| 65 |
+
app, c, svc, _ = make_app()
|
| 66 |
+
h = bearer(c, "consultant")
|
| 67 |
+
ids = []
|
| 68 |
+
for patch in ("26C", "2026-10", "26B"):
|
| 69 |
+
r = c.post("/api/runs", json={"modules": ["P2P"], "playwright_mode": "stub", "patch_id": patch}, headers=h)
|
| 70 |
+
self.assertEqual(r.status_code, 202, r.text)
|
| 71 |
+
ids.append(r.json()["run_id"])
|
| 72 |
+
for rid in ids:
|
| 73 |
+
app.state.runs.cancel(rid, "test")
|
| 74 |
+
d = c.get("/api/readiness", headers=h).json()
|
| 75 |
+
self.assertEqual(d["patches"], ["26B", "2026-10", "26C"])
|
| 76 |
+
self.assertEqual([x["cadence"] for x in d["patch_cycles"]], ["quarterly", "monthly", "quarterly"])
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
if __name__ == "__main__":
|
| 80 |
+
unittest.main()
|
coworker/tests/test_consultant.py
CHANGED
|
@@ -109,6 +109,8 @@ class TestConsultantApi(unittest.TestCase):
|
|
| 109 |
self.assertEqual(wb.sheetnames, ["Read me", "Test script", "Scenarios"])
|
| 110 |
readme = " ".join(str(c.value) for row in wb["Read me"].iter_rows() for c in row if c.value)
|
| 111 |
self.assertIn("not Oracle Fusion", readme)
|
|
|
|
|
|
|
| 112 |
ts = wb["Test script"]
|
| 113 |
head = [c.value for c in ts[1]]
|
| 114 |
self.assertEqual(head[:4] + head[8:11] + head[14:], ["Scenario ID", "Business area", "Process step", "Scenario", "Step", "Action",
|
|
|
|
| 109 |
self.assertEqual(wb.sheetnames, ["Read me", "Test script", "Scenarios"])
|
| 110 |
readme = " ".join(str(c.value) for row in wb["Read me"].iter_rows() for c in row if c.value)
|
| 111 |
self.assertIn("not Oracle Fusion", readme)
|
| 112 |
+
self.assertIn("Trio Co-Worker", readme) # the product name, not the earlier one
|
| 113 |
+
self.assertEqual(wb.properties.creator, "Trio Co-Worker")
|
| 114 |
ts = wb["Test script"]
|
| 115 |
head = [c.value for c in ts[1]]
|
| 116 |
self.assertEqual(head[:4] + head[8:11] + head[14:], ["Scenario ID", "Business area", "Process step", "Scenario", "Step", "Action",
|
coworker/tests/test_hermes.py
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Hermes assistant (/api/assistant) against a simulated Hermes API server (no network).
|
| 2 |
+
|
| 3 |
+
Off -> 409 HERMES_OFF; on without a key -> a clear error; on with Hermes -> an answer and a continuing conversation;
|
| 4 |
+
the key and the question text never reach the audit log; the egress gate keeps to the configured host (https only);
|
| 5 |
+
timeouts, unreachable hosts and a wrong key give clear errors."""
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import json
|
| 9 |
+
import os
|
| 10 |
+
import unittest
|
| 11 |
+
|
| 12 |
+
import httpx
|
| 13 |
+
|
| 14 |
+
from coworker.graph.services import build_services
|
| 15 |
+
from coworker.platform import hermes
|
| 16 |
+
from coworker.platform.egress import EgressDenied
|
| 17 |
+
from coworker.tests.fakes import PASSWORD, ROLES, FakePod, bearer, temp_settings
|
| 18 |
+
|
| 19 |
+
URL = "https://hermes.example.hf.space"
|
| 20 |
+
KEY = "hermes-test-KEY-0123456789abcdef-do-not-leak"
|
| 21 |
+
QUESTION = "Which payables scenarios failed in the last run?"
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class FakeHermes:
|
| 25 |
+
"""Just enough of Hermes' OpenAI-compatible API server: bearer key, /v1/models, /v1/chat/completions with
|
| 26 |
+
X-Hermes-Session-Id continuity."""
|
| 27 |
+
|
| 28 |
+
def __init__(self, key: str = KEY, mode: str = "ok"):
|
| 29 |
+
self.key, self.mode, self.seen, self.sessions = key, mode, [], {}
|
| 30 |
+
|
| 31 |
+
def handler(self, req: httpx.Request) -> httpx.Response:
|
| 32 |
+
self.seen.append(req)
|
| 33 |
+
if self.mode == "timeout":
|
| 34 |
+
raise httpx.ReadTimeout("timed out", request=req)
|
| 35 |
+
if self.mode == "down":
|
| 36 |
+
raise httpx.ConnectError("connection refused", request=req)
|
| 37 |
+
if req.headers.get("authorization") != f"Bearer {self.key}":
|
| 38 |
+
return httpx.Response(401, json={"error": {"message": "Invalid API key", "type": "invalid_request_error"}})
|
| 39 |
+
if req.url.path == "/v1/models":
|
| 40 |
+
return httpx.Response(200, json={"object": "list", "data": [{"id": "hermes-agent", "object": "model"}]})
|
| 41 |
+
if req.url.path == "/v1/chat/completions" and req.method == "POST":
|
| 42 |
+
body = json.loads(req.content)
|
| 43 |
+
sid = req.headers.get("x-hermes-session-id", "derived")
|
| 44 |
+
turns = self.sessions.setdefault(sid, [])
|
| 45 |
+
turns.append(body["messages"][-1]["content"])
|
| 46 |
+
answer = f"Answer {len(turns)} for session {sid}"
|
| 47 |
+
return httpx.Response(200, headers={"X-Hermes-Session-Id": sid}, json={
|
| 48 |
+
"id": "chatcmpl-1", "object": "chat.completion", "model": "hermes-agent",
|
| 49 |
+
"choices": [{"index": 0, "message": {"role": "assistant", "content": answer}, "finish_reason": "stop"}]})
|
| 50 |
+
return httpx.Response(404, json={"error": {"message": "not found"}})
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def make(fake: FakeHermes | None, *, key: str | None = KEY, **over):
|
| 54 |
+
from fastapi.testclient import TestClient
|
| 55 |
+
|
| 56 |
+
from coworker.api.app import create_app
|
| 57 |
+
pod = FakePod()
|
| 58 |
+
|
| 59 |
+
def route(req: httpx.Request) -> httpx.Response:
|
| 60 |
+
if fake is not None and req.url.host == "hermes.example.hf.space":
|
| 61 |
+
return fake.handler(req)
|
| 62 |
+
return pod.handler(req)
|
| 63 |
+
if key:
|
| 64 |
+
os.environ["FPT_SECRET_HERMES_API_KEY"] = key
|
| 65 |
+
else:
|
| 66 |
+
os.environ.pop("FPT_SECRET_HERMES_API_KEY", None)
|
| 67 |
+
cfg = temp_settings(**{"hermes_url": URL, "hermes_enabled": True, **over})
|
| 68 |
+
svc = build_services(cfg, transport=httpx.MockTransport(route))
|
| 69 |
+
for r in ROLES:
|
| 70 |
+
svc.users.create(r, PASSWORD, r, created_by="test")
|
| 71 |
+
app = create_app(svc, background=False)
|
| 72 |
+
return TestClient(app), svc
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
class TestHermesAssistant(unittest.TestCase):
|
| 76 |
+
def setUp(self):
|
| 77 |
+
hermes.reset_caches()
|
| 78 |
+
|
| 79 |
+
def tearDown(self):
|
| 80 |
+
os.environ.pop("FPT_SECRET_HERMES_API_KEY", None)
|
| 81 |
+
hermes.reset_caches()
|
| 82 |
+
|
| 83 |
+
def test_off_answers_409_and_makes_no_call(self):
|
| 84 |
+
fake = FakeHermes()
|
| 85 |
+
c, _ = make(fake, hermes_enabled=False)
|
| 86 |
+
h = bearer(c, "viewer")
|
| 87 |
+
r = c.post("/api/assistant/ask", json={"question": QUESTION}, headers=h)
|
| 88 |
+
self.assertEqual(r.status_code, 409, r.text)
|
| 89 |
+
self.assertEqual(r.json()["code"], "HERMES_OFF")
|
| 90 |
+
self.assertEqual(c.get("/api/assistant/status", headers=h).json(), {"enabled": False, "configured": True, "reachable": None})
|
| 91 |
+
self.assertEqual(fake.seen, [])
|
| 92 |
+
|
| 93 |
+
def test_on_without_key_is_a_clear_error(self):
|
| 94 |
+
fake = FakeHermes()
|
| 95 |
+
c, _ = make(fake, key=None)
|
| 96 |
+
h = bearer(c, "viewer")
|
| 97 |
+
r = c.post("/api/assistant/ask", json={"question": QUESTION}, headers=h)
|
| 98 |
+
self.assertEqual(r.status_code, 503)
|
| 99 |
+
self.assertEqual(r.json()["code"], "HERMES_NOT_CONFIGURED")
|
| 100 |
+
self.assertIn("HERMES_API_KEY", r.json()["detail"])
|
| 101 |
+
self.assertEqual(c.get("/api/assistant/status", headers=h).json(), {"enabled": True, "configured": False, "reachable": None})
|
| 102 |
+
self.assertEqual(fake.seen, [])
|
| 103 |
+
|
| 104 |
+
def test_on_without_url_is_a_clear_error(self):
|
| 105 |
+
c, _ = make(FakeHermes(), hermes_url="")
|
| 106 |
+
r = c.post("/api/assistant/ask", json={"question": QUESTION}, headers=bearer(c, "viewer"))
|
| 107 |
+
self.assertEqual((r.status_code, r.json()["code"]), (503, "HERMES_NOT_CONFIGURED"))
|
| 108 |
+
self.assertIn("FPT_HERMES_URL", r.json()["detail"])
|
| 109 |
+
|
| 110 |
+
def test_answer_and_conversation_continues(self):
|
| 111 |
+
fake = FakeHermes()
|
| 112 |
+
c, _ = make(fake)
|
| 113 |
+
h = bearer(c, "viewer")
|
| 114 |
+
r = c.post("/api/assistant/ask", json={"question": QUESTION}, headers=h)
|
| 115 |
+
self.assertEqual(r.status_code, 200, r.text)
|
| 116 |
+
d = r.json()
|
| 117 |
+
self.assertEqual(d["model"], "hermes-agent")
|
| 118 |
+
cid = d["conversation_id"]
|
| 119 |
+
self.assertRegex(cid, r"^fpt-u\d+-[0-9a-f]{16}$")
|
| 120 |
+
self.assertEqual(d["answer"], f"Answer 1 for session {cid}")
|
| 121 |
+
req = fake.seen[-1]
|
| 122 |
+
self.assertEqual(req.url.path, "/v1/chat/completions")
|
| 123 |
+
self.assertEqual(req.headers["x-hermes-session-id"], cid)
|
| 124 |
+
sent = json.loads(req.content)
|
| 125 |
+
self.assertEqual(sent["messages"], [{"role": "user", "content": QUESTION}])
|
| 126 |
+
self.assertFalse(sent["stream"])
|
| 127 |
+
r2 = c.post("/api/assistant/ask", json={"question": "And why?", "conversation_id": cid}, headers=h)
|
| 128 |
+
self.assertEqual(r2.json()["answer"], f"Answer 2 for session {cid}")
|
| 129 |
+
self.assertEqual(c.get("/api/assistant/status", headers=h).json(), {"enabled": True, "configured": True, "reachable": True})
|
| 130 |
+
|
| 131 |
+
def test_someone_elses_conversation_is_not_found(self):
|
| 132 |
+
fake = FakeHermes()
|
| 133 |
+
c, _ = make(fake)
|
| 134 |
+
cid = c.post("/api/assistant/ask", json={"question": QUESTION}, headers=bearer(c, "viewer")).json()["conversation_id"]
|
| 135 |
+
n = len(fake.seen)
|
| 136 |
+
for other in (cid, "fpt-u1-zzzz", "../../etc"):
|
| 137 |
+
r = c.post("/api/assistant/ask", json={"question": QUESTION, "conversation_id": other}, headers=bearer(c, "consultant"))
|
| 138 |
+
self.assertEqual(r.status_code, 404, other)
|
| 139 |
+
self.assertEqual(len(fake.seen), n)
|
| 140 |
+
|
| 141 |
+
def test_key_and_question_never_in_audit(self):
|
| 142 |
+
fake = FakeHermes()
|
| 143 |
+
c, svc = make(fake)
|
| 144 |
+
self.assertEqual(c.post("/api/assistant/ask", json={"question": QUESTION}, headers=bearer(c, "viewer")).status_code, 200)
|
| 145 |
+
c.post("/api/assistant/ask", json={"question": QUESTION}, headers={**bearer(c, "viewer")})
|
| 146 |
+
rows = svc.db.q("SELECT kind, summary, payload FROM audit_log")
|
| 147 |
+
blob = json.dumps(rows)
|
| 148 |
+
self.assertNotIn(KEY, blob)
|
| 149 |
+
self.assertNotIn(QUESTION, blob)
|
| 150 |
+
self.assertNotIn("Answer 1", blob)
|
| 151 |
+
kinds = {r["kind"] for r in rows}
|
| 152 |
+
self.assertTrue({"egress.hermes.request", "egress.hermes.response", "assistant.asked"} <= kinds, kinds)
|
| 153 |
+
|
| 154 |
+
def test_host_lock_and_https_only(self):
|
| 155 |
+
_, svc = make(FakeHermes())
|
| 156 |
+
with self.assertRaises(EgressDenied):
|
| 157 |
+
svc.egress.hermes_request("GET", "https://evil.example.com/v1/models", key=KEY)
|
| 158 |
+
with self.assertRaises(EgressDenied):
|
| 159 |
+
svc.egress.hermes_request("GET", "/api/config", key=KEY) # only the /v1 API
|
| 160 |
+
svc.cfg.hermes_url = "http://hermes.example.hf.space"
|
| 161 |
+
with self.assertRaises(EgressDenied):
|
| 162 |
+
svc.egress.hermes_request("GET", "/v1/models", key=KEY)
|
| 163 |
+
svc.cfg.hermes_url = URL + "/v1" # a trailing /v1 is tolerated
|
| 164 |
+
self.assertEqual(svc.egress.hermes_request("GET", "/v1/models", key=KEY).status_code, 200)
|
| 165 |
+
|
| 166 |
+
def test_http_url_gives_a_clear_error(self):
|
| 167 |
+
fake = FakeHermes()
|
| 168 |
+
c, _ = make(fake, hermes_url="http://hermes.example.hf.space")
|
| 169 |
+
r = c.post("/api/assistant/ask", json={"question": QUESTION}, headers=bearer(c, "viewer"))
|
| 170 |
+
self.assertEqual((r.status_code, r.json()["code"]), (503, "HERMES_REFUSED"))
|
| 171 |
+
self.assertIn("https", r.json()["detail"])
|
| 172 |
+
self.assertEqual(fake.seen, [])
|
| 173 |
+
|
| 174 |
+
def test_secret_in_question_is_refused(self):
|
| 175 |
+
fake = FakeHermes()
|
| 176 |
+
c, _ = make(fake)
|
| 177 |
+
r = c.post("/api/assistant/ask", json={"question": f"is {KEY} right?"}, headers=bearer(c, "viewer"))
|
| 178 |
+
self.assertEqual((r.status_code, r.json()["code"]), (503, "HERMES_REFUSED"))
|
| 179 |
+
self.assertEqual(fake.seen, [])
|
| 180 |
+
|
| 181 |
+
def test_timeout_unreachable_and_wrong_key(self):
|
| 182 |
+
c, _ = make(FakeHermes(mode="timeout"))
|
| 183 |
+
r = c.post("/api/assistant/ask", json={"question": QUESTION}, headers=bearer(c, "viewer"))
|
| 184 |
+
self.assertEqual((r.status_code, r.json()["code"]), (504, "HERMES_TIMEOUT"))
|
| 185 |
+
hermes.reset_caches()
|
| 186 |
+
c, _ = make(FakeHermes(mode="down"))
|
| 187 |
+
h = bearer(c, "viewer")
|
| 188 |
+
r = c.post("/api/assistant/ask", json={"question": QUESTION}, headers=h)
|
| 189 |
+
self.assertEqual((r.status_code, r.json()["code"]), (502, "HERMES_UNREACHABLE"))
|
| 190 |
+
self.assertFalse(c.get("/api/assistant/status", headers=h).json()["reachable"])
|
| 191 |
+
hermes.reset_caches()
|
| 192 |
+
c, _ = make(FakeHermes(key="another-key-entirely-0123456789"))
|
| 193 |
+
h = bearer(c, "viewer")
|
| 194 |
+
r = c.post("/api/assistant/ask", json={"question": QUESTION}, headers=h)
|
| 195 |
+
self.assertEqual((r.status_code, r.json()["code"]), (502, "HERMES_KEY_REJECTED"))
|
| 196 |
+
self.assertFalse(c.get("/api/assistant/status", headers=h).json()["reachable"])
|
| 197 |
+
|
| 198 |
+
def test_status_is_cached(self):
|
| 199 |
+
fake = FakeHermes()
|
| 200 |
+
c, _ = make(fake)
|
| 201 |
+
h = bearer(c, "viewer")
|
| 202 |
+
for _ in range(3):
|
| 203 |
+
self.assertTrue(c.get("/api/assistant/status", headers=h).json()["reachable"])
|
| 204 |
+
self.assertEqual(sum(1 for q in fake.seen if q.url.path == "/v1/models"), 1)
|
| 205 |
+
|
| 206 |
+
def test_rate_limited_per_user(self):
|
| 207 |
+
fake = FakeHermes()
|
| 208 |
+
c, _ = make(fake, hermes_rate_per_minute=2)
|
| 209 |
+
h = bearer(c, "viewer")
|
| 210 |
+
codes = [c.post("/api/assistant/ask", json={"question": QUESTION}, headers=h).status_code for _ in range(3)]
|
| 211 |
+
self.assertEqual(codes, [200, 200, 429])
|
| 212 |
+
r = c.post("/api/assistant/ask", json={"question": QUESTION}, headers=h)
|
| 213 |
+
self.assertIn("Retry-After", r.headers)
|
| 214 |
+
self.assertEqual(c.post("/api/assistant/ask", json={"question": QUESTION}, headers=bearer(c, "consultant")).status_code, 200)
|
| 215 |
+
|
| 216 |
+
def test_needs_sign_in(self):
|
| 217 |
+
c, _ = make(FakeHermes())
|
| 218 |
+
self.assertEqual(c.post("/api/assistant/ask", json={"question": QUESTION}).status_code, 401)
|
| 219 |
+
self.assertEqual(c.get("/api/assistant/status").status_code, 401)
|
| 220 |
+
|
| 221 |
+
def test_key_not_in_public_config(self):
|
| 222 |
+
c, _ = make(FakeHermes())
|
| 223 |
+
self.assertNotIn(KEY, c.get("/api/config", headers=bearer(c, "admin")).text)
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
if __name__ == "__main__":
|
| 227 |
+
unittest.main()
|
coworker/tests/test_llm_settings.py
CHANGED
|
@@ -88,5 +88,48 @@ class TestLLMSettings(unittest.TestCase):
|
|
| 88 |
self.assertEqual(self.c.get("/api/llm/settings", headers=self.h["admin"]).json()["active"]["external"], "off")
|
| 89 |
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
if __name__ == "__main__":
|
| 92 |
unittest.main()
|
|
|
|
| 88 |
self.assertEqual(self.c.get("/api/llm/settings", headers=self.h["admin"]).json()["active"]["external"], "off")
|
| 89 |
|
| 90 |
|
| 91 |
+
class TestExternalModelFromEnvironment(unittest.TestCase):
|
| 92 |
+
"""A restart (or a lost snapshot) must not turn the external model off when the environment names it and holds its key."""
|
| 93 |
+
BASE = "https://integrate.api.nvidia.com/v1"
|
| 94 |
+
|
| 95 |
+
def setUp(self):
|
| 96 |
+
import os
|
| 97 |
+
self._old = os.environ.get("FPT_SECRET_FRONTIER_API_KEY")
|
| 98 |
+
|
| 99 |
+
def tearDown(self):
|
| 100 |
+
import os
|
| 101 |
+
os.environ.pop("FPT_SECRET_FRONTIER_API_KEY", None) if self._old is None else os.environ.__setitem__("FPT_SECRET_FRONTIER_API_KEY", self._old)
|
| 102 |
+
|
| 103 |
+
def build(self, key: bool = True, **over):
|
| 104 |
+
import os
|
| 105 |
+
|
| 106 |
+
from coworker.graph.services import build_services
|
| 107 |
+
from coworker.tests.fakes import FakePod, temp_settings
|
| 108 |
+
cfg = temp_settings(**over)
|
| 109 |
+
if key:
|
| 110 |
+
os.environ["FPT_SECRET_FRONTIER_API_KEY"] = "nvapi-test-key-not-real" # after temp_settings, which clears it
|
| 111 |
+
return build_services(cfg, transport=FakePod().transport())
|
| 112 |
+
|
| 113 |
+
def test_base_url_model_and_key_switch_it_on_when_nothing_is_saved(self):
|
| 114 |
+
svc = self.build(frontier_base_url=self.BASE, frontier_model="nvidia/llama-3.3-nemotron")
|
| 115 |
+
self.assertEqual(svc.cfg.llm_frontier, "frontier")
|
| 116 |
+
self.assertIsNotNone(svc.router.frontier)
|
| 117 |
+
self.assertTrue(svc.cfg.public_dict()["frontier_configured"])
|
| 118 |
+
|
| 119 |
+
def test_not_without_a_key_or_an_https_address_or_when_opted_out(self):
|
| 120 |
+
self.assertEqual(self.build(key=False, frontier_base_url=self.BASE).cfg.llm_frontier, "off")
|
| 121 |
+
self.assertEqual(self.build(frontier_base_url="http://api.example.com/v1").cfg.llm_frontier, "off")
|
| 122 |
+
self.assertEqual(self.build(frontier_base_url=self.BASE, frontier_auto=False).cfg.llm_frontier, "off")
|
| 123 |
+
self.assertEqual(self.build().cfg.llm_frontier, "off")
|
| 124 |
+
|
| 125 |
+
def test_what_an_administrator_saved_wins_even_when_it_says_off(self):
|
| 126 |
+
svc = self.build(frontier_base_url=self.BASE)
|
| 127 |
+
svc.db.kv_set(L.KV, {"llm_frontier": "off", "frontier_base_url": self.BASE, "frontier_model": "m"})
|
| 128 |
+
from coworker.graph.services import build_services
|
| 129 |
+
svc2 = build_services(svc.cfg.model_copy(update={"llm_frontier": "off"}), transport=None)
|
| 130 |
+
self.assertEqual(svc2.cfg.llm_frontier, "off")
|
| 131 |
+
self.assertIsNone(svc2.router.frontier)
|
| 132 |
+
|
| 133 |
+
|
| 134 |
if __name__ == "__main__":
|
| 135 |
unittest.main()
|
coworker/tests/test_pods.py
CHANGED
|
@@ -89,3 +89,72 @@ class TestPods(unittest.TestCase):
|
|
| 89 |
self.assertEqual(run["pod_name"], "Local mock pod")
|
| 90 |
self.assertIsNotNone(run["pod_id"])
|
| 91 |
self.app.state.runs.cancel(rid, "test")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
self.assertEqual(run["pod_name"], "Local mock pod")
|
| 90 |
self.assertIsNotNone(run["pod_id"])
|
| 91 |
self.app.state.runs.cancel(rid, "test")
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
class TestPodFromServerSettings(unittest.TestCase):
|
| 95 |
+
"""FPT_FUSION_BASE_URL + the secrets FPT_SECRET_FUSION_USERNAME / _PASSWORD: the Fusion pod exists after every start,
|
| 96 |
+
even when the saved data is empty, and its test user never has to be typed in again."""
|
| 97 |
+
URL = "https://acme-test.fa.ocs.oraclecloud.com"
|
| 98 |
+
|
| 99 |
+
def setUp(self):
|
| 100 |
+
import os
|
| 101 |
+
self._saved = {k: os.environ.get(k) for k in ("FPT_SECRET_FUSION_USERNAME", "FPT_SECRET_FUSION_PASSWORD")}
|
| 102 |
+
os.environ["FPT_SECRET_FUSION_USERNAME"], os.environ["FPT_SECRET_FUSION_PASSWORD"] = "svc.tester", "Env-Only-Pw-123!"
|
| 103 |
+
|
| 104 |
+
def tearDown(self):
|
| 105 |
+
import os
|
| 106 |
+
for k, v in self._saved.items():
|
| 107 |
+
os.environ.pop(k, None) if v is None else os.environ.__setitem__(k, v)
|
| 108 |
+
|
| 109 |
+
def test_pod_is_created_from_settings_with_its_test_user_and_runs_can_use_it(self):
|
| 110 |
+
_, c, svc, _ = make_app(fusion_base_url=self.URL + "/", fusion_name="Acme Fusion test")
|
| 111 |
+
h = bearer(c, "viewer")
|
| 112 |
+
pods = c.get("/api/pods", headers=h).json()
|
| 113 |
+
fusion = [p for p in pods if p["kind"] == "fusion"]
|
| 114 |
+
self.assertEqual(len(fusion), 1)
|
| 115 |
+
p = fusion[0]
|
| 116 |
+
self.assertEqual((p["name"], p["base_url"], p["environment"], p["modules"]), ("Acme Fusion test", self.URL, "test", ["AP"]))
|
| 117 |
+
self.assertTrue(p["from_server_settings"])
|
| 118 |
+
self.assertTrue(p["runnable"], p["not_runnable_reason"])
|
| 119 |
+
self.assertEqual([x["module"] for x in p["credentials"]], ["ALL"])
|
| 120 |
+
from coworker.platform.pods import PodRegistry
|
| 121 |
+
env = PodRegistry(svc.db, svc.vault, svc.cfg, svc.egress, svc.audit).executor_env(p["id"])
|
| 122 |
+
self.assertEqual((env["FUSION_USERNAME"], env["FUSION_PASSWORD"]), ("svc.tester", "Env-Only-Pw-123!"))
|
| 123 |
+
# the password is in no API answer and no vault file
|
| 124 |
+
self.assertNotIn("Env-Only-Pw-123!", json.dumps(pods))
|
| 125 |
+
vault_file = svc.cfg.home / "secrets" / "vault.json"
|
| 126 |
+
self.assertNotIn("Env-Only-Pw-123!", vault_file.read_text(encoding="utf-8"))
|
| 127 |
+
|
| 128 |
+
def test_idempotent_and_an_empty_database_gets_the_pod_back(self):
|
| 129 |
+
_, c, svc, _ = make_app(fusion_base_url=self.URL)
|
| 130 |
+
from coworker.platform.pods import PodRegistry
|
| 131 |
+
for _ in range(3):
|
| 132 |
+
PodRegistry(svc.db, svc.vault, svc.cfg, svc.egress, svc.audit)
|
| 133 |
+
self.assertEqual(len([p for p in c.get("/api/pods", headers=bearer(c, "viewer")).json() if p["kind"] == "fusion"]), 1)
|
| 134 |
+
# a pod the person registered earlier (same address) is kept as it is, not duplicated or renamed
|
| 135 |
+
svc.db.x("DELETE FROM pod_credentials")
|
| 136 |
+
svc.db.x("UPDATE pods SET name='My own name' WHERE kind='fusion'")
|
| 137 |
+
reg = PodRegistry(svc.db, svc.vault, svc.cfg, svc.egress, svc.audit)
|
| 138 |
+
fusion = [p for p in reg.list() if p["kind"] == "fusion"]
|
| 139 |
+
self.assertEqual([p["name"] for p in fusion], ["My own name"])
|
| 140 |
+
self.assertTrue(fusion[0]["runnable"])
|
| 141 |
+
|
| 142 |
+
def test_without_the_secrets_the_pod_exists_but_asks_for_a_test_user(self):
|
| 143 |
+
import os
|
| 144 |
+
os.environ.pop("FPT_SECRET_FUSION_PASSWORD")
|
| 145 |
+
_, c, _, _ = make_app(fusion_base_url=self.URL)
|
| 146 |
+
p = [p for p in c.get("/api/pods", headers=bearer(c, "viewer")).json() if p["kind"] == "fusion"][0]
|
| 147 |
+
self.assertFalse(p["runnable"])
|
| 148 |
+
self.assertIn("Set the test user", p["not_runnable_reason"])
|
| 149 |
+
|
| 150 |
+
def test_it_cannot_be_deleted_or_moved_but_can_be_disabled_and_production_is_refused(self):
|
| 151 |
+
_, c, _, _ = make_app(fusion_base_url=self.URL)
|
| 152 |
+
h = bearer(c, "admin")
|
| 153 |
+
p = [p for p in c.get("/api/pods", headers=h).json() if p["kind"] == "fusion"][0]
|
| 154 |
+
r = c.delete(f"/api/pods/{p['id']}", headers=h)
|
| 155 |
+
self.assertEqual((r.status_code, r.json()["code"]), (409, "FROM_SETTINGS"))
|
| 156 |
+
r = c.patch(f"/api/pods/{p['id']}", json={"base_url": "https://other-test.fa.ocs.oraclecloud.com"}, headers=h)
|
| 157 |
+
self.assertEqual(r.json()["code"], "FROM_SETTINGS")
|
| 158 |
+
self.assertEqual(c.patch(f"/api/pods/{p['id']}", json={"enabled": False}, headers=h).status_code, 200)
|
| 159 |
+
_, c2, _, _ = make_app(fusion_base_url="https://acme-prod.fa.ocs.oraclecloud.com")
|
| 160 |
+
self.assertEqual([p for p in c2.get("/api/pods", headers=bearer(c2, "viewer")).json() if p["kind"] == "fusion"], [])
|
coworker/tests/test_supabase.py
CHANGED
|
@@ -260,6 +260,47 @@ class TestStateSync(unittest.TestCase):
|
|
| 260 |
statesync.restore(cfg2, sb.Supabase(cfg2, svc.egress, None))
|
| 261 |
self.assertFalse((fresh / "fpt.sqlite").exists())
|
| 262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
def test_storage_only_talks_to_the_project_host(self):
|
| 264 |
fake = FakeSupabase()
|
| 265 |
_, _, svc = make(fake)
|
|
|
|
| 260 |
statesync.restore(cfg2, sb.Supabase(cfg2, svc.egress, None))
|
| 261 |
self.assertFalse((fresh / "fpt.sqlite").exists())
|
| 262 |
|
| 263 |
+
def test_a_failed_restore_never_overwrites_the_saved_state(self):
|
| 264 |
+
fake = FakeSupabase(confirm=False)
|
| 265 |
+
_, c, svc = make(fake)
|
| 266 |
+
c.post("/api/auth/register", json={"email": "keep@example.com", "password": SECRET_PW})
|
| 267 |
+
statesync.push(svc, "test")
|
| 268 |
+
good = fake.objects[f"{svc.cfg.supabase_bucket}/{statesync.OBJECT}"]
|
| 269 |
+
# a new instance whose start-up restore cannot read the bucket (storage answers 500)
|
| 270 |
+
fresh = Path(tempfile.mkdtemp(prefix="fpt-restore-"))
|
| 271 |
+
cfg2 = svc.cfg.model_copy(update={"fpt_home": fresh})
|
| 272 |
+
real = fake.handler
|
| 273 |
+
fake.handler = lambda req: httpx.Response(500, json={"message": "down"}) if req.url.path.startswith("/storage/") else real(req)
|
| 274 |
+
done, err = statesync.restore_at_boot(cfg2, sb.Supabase(cfg2, svc.egress, None), attempts=3, sleep=lambda s: None)
|
| 275 |
+
self.assertFalse(done)
|
| 276 |
+
self.assertIn("download failed", err)
|
| 277 |
+
self.assertTrue(statesync.restore_failed(fresh))
|
| 278 |
+
fake.handler = real
|
| 279 |
+
# the instance starts empty; its saver must refuse to replace the good archive with that empty state
|
| 280 |
+
svc2 = build_services(cfg2, transport=svc.egress._transport if hasattr(svc.egress, "_transport") else None)
|
| 281 |
+
s = statesync.Syncer(svc2, 60)
|
| 282 |
+
self.assertFalse(s.tick())
|
| 283 |
+
self.assertIn("saving is paused", s.last_error or "")
|
| 284 |
+
self.assertEqual(fake.objects[f"{svc.cfg.supabase_bucket}/{statesync.OBJECT}"], good)
|
| 285 |
+
# the next start (marker removed by the boot restore) restores normally
|
| 286 |
+
fresh2 = Path(tempfile.mkdtemp(prefix="fpt-restore-"))
|
| 287 |
+
cfg3 = svc.cfg.model_copy(update={"fpt_home": fresh2})
|
| 288 |
+
(fresh2).mkdir(exist_ok=True)
|
| 289 |
+
(fresh2 / statesync.FAILED_MARKER).write_text("old", encoding="utf-8")
|
| 290 |
+
done, err = statesync.restore_at_boot(cfg3, sb.Supabase(cfg3, svc.egress, None), sleep=lambda s: None)
|
| 291 |
+
self.assertEqual((done, err), (True, None))
|
| 292 |
+
self.assertFalse(statesync.restore_failed(fresh2))
|
| 293 |
+
|
| 294 |
+
def test_first_save_keeps_a_copy_of_what_the_bucket_held(self):
|
| 295 |
+
fake = FakeSupabase(confirm=False)
|
| 296 |
+
_, _, svc = make(fake)
|
| 297 |
+
statesync.push(svc, "one")
|
| 298 |
+
first = fake.objects[f"{svc.cfg.supabase_bucket}/{statesync.OBJECT}"]
|
| 299 |
+
_, _, svc2 = make(fake) # a second process, same bucket: its first save keeps the first archive
|
| 300 |
+
svc2.users.create("newperson", PASSWORD, "viewer", created_by="test")
|
| 301 |
+
statesync.push(svc2, "two")
|
| 302 |
+
self.assertEqual(fake.objects[f"{svc.cfg.supabase_bucket}/{statesync.PREVIOUS}"], first)
|
| 303 |
+
|
| 304 |
def test_storage_only_talks_to_the_project_host(self):
|
| 305 |
fake = FakeSupabase()
|
| 306 |
_, _, svc = make(fake)
|
coworker/workflows/activities.py
CHANGED
|
@@ -365,8 +365,8 @@ def create_scheduled_run(schedule_id: int) -> str | None:
|
|
| 365 |
sch = s.db.one("SELECT * FROM schedules WHERE id=? AND enabled=1", (schedule_id,))
|
| 366 |
if not sch or s.kill.engaged():
|
| 367 |
return None
|
| 368 |
-
|
| 369 |
-
|
| 370 |
|
| 371 |
|
| 372 |
@activity.defn(name="purge")
|
|
|
|
| 365 |
sch = s.db.one("SELECT * FROM schedules WHERE id=? AND enabled=1", (schedule_id,))
|
| 366 |
if not sch or s.kill.engaged():
|
| 367 |
return None
|
| 368 |
+
from ..platform.scheduler import run_inputs
|
| 369 |
+
return _RunCreator(s).start(run_inputs(sch), actor=f"schedule:{schedule_id}", trigger="schedule")
|
| 370 |
|
| 371 |
|
| 372 |
@activity.defn(name="purge")
|
coworker/workflows/client.py
CHANGED
|
@@ -207,8 +207,8 @@ class TemporalScheduler(Scheduler):
|
|
| 207 |
if s["kind"] == "interval":
|
| 208 |
spec = ScheduleSpec(intervals=[ScheduleIntervalSpec(every=timedelta(minutes=int(s["every_minutes"] or 60)))])
|
| 209 |
else:
|
| 210 |
-
|
| 211 |
-
spec = ScheduleSpec(cron_expressions=[
|
| 212 |
await self._upsert(sid, "ScheduledRunWorkflow", {**base, "schedule_id": s["id"]}, spec)
|
| 213 |
|
| 214 |
def sync(self) -> None:
|
|
|
|
| 207 |
if s["kind"] == "interval":
|
| 208 |
spec = ScheduleSpec(intervals=[ScheduleIntervalSpec(every=timedelta(minutes=int(s["every_minutes"] or 60)))])
|
| 209 |
else:
|
| 210 |
+
from ..platform.scheduler import cron_of
|
| 211 |
+
spec = ScheduleSpec(cron_expressions=[cron_of(s)])
|
| 212 |
await self._upsert(sid, "ScheduledRunWorkflow", {**base, "schedule_id": s["id"]}, spec)
|
| 213 |
|
| 214 |
def sync(self) -> None:
|
deploy/.env.example
CHANGED
|
@@ -13,7 +13,7 @@ FPT_BOOTSTRAP_ADMIN_PASSWORD=change-me-to-a-long-passphrase
|
|
| 13 |
FPT_IMAGE=patch-coworker:1.0.0
|
| 14 |
|
| 15 |
# --- product name shown in the menu and on the sign-in page
|
| 16 |
-
FPT_PRODUCT_NAME=
|
| 17 |
FPT_ORG_NAME=
|
| 18 |
|
| 19 |
# --- AI models can also be set in the app (Settings > AI models). Values saved there win over these.
|
|
|
|
| 13 |
FPT_IMAGE=patch-coworker:1.0.0
|
| 14 |
|
| 15 |
# --- product name shown in the menu and on the sign-in page
|
| 16 |
+
FPT_PRODUCT_NAME=Trio Co-Worker
|
| 17 |
FPT_ORG_NAME=
|
| 18 |
|
| 19 |
# --- AI models can also be set in the app (Settings > AI models). Values saved there win over these.
|
deploy/DEPLOY.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# Deploying
|
| 2 |
|
| 3 |
One deployment serves one customer. Everything the product stores stays on the customer's own server, in Docker
|
| 4 |
volumes: nothing is kept outside their environment.
|
|
@@ -100,3 +100,19 @@ These are the limits of the product today, not of the packaging. Say them plainl
|
|
| 100 |
- **Windows desktop app**: the installer is not code-signed.
|
| 101 |
- **Updates and licensing**: there is no licence check, update channel or usage metering.
|
| 102 |
- **No independent security test** (penetration test) has been done.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Deploying Trio Co-Worker in a customer's cloud
|
| 2 |
|
| 3 |
One deployment serves one customer. Everything the product stores stays on the customer's own server, in Docker
|
| 4 |
volumes: nothing is kept outside their environment.
|
|
|
|
| 100 |
- **Windows desktop app**: the installer is not code-signed.
|
| 101 |
- **Updates and licensing**: there is no licence check, update channel or usage metering.
|
| 102 |
- **No independent security test** (penetration test) has been done.
|
| 103 |
+
|
| 104 |
+
## Settings that make the demo survive a restart (Hugging Face Space or any host without a disk)
|
| 105 |
+
|
| 106 |
+
The app keeps its data in an encrypted snapshot in Supabase Storage and restores it at start. These settings rebuild the
|
| 107 |
+
essentials from the environment, so a lost or unreadable snapshot never leaves the product without its pod or its AI model.
|
| 108 |
+
|
| 109 |
+
| Setting | Kind | Effect |
|
| 110 |
+
|---|---|---|
|
| 111 |
+
| `FPT_FUSION_BASE_URL` (`https://<pod>.fa.ocs.oraclecloud.com`), `FPT_FUSION_NAME`, `FPT_FUSION_ENVIRONMENT`, `FPT_FUSION_MODULES` | variable | The Oracle Fusion test pod exists after every start. Production addresses are refused. |
|
| 112 |
+
| `FPT_SECRET_FUSION_USERNAME`, `FPT_SECRET_FUSION_PASSWORD` | secret | The pod's test user. Never written to the vault file or shown. |
|
| 113 |
+
| `FRONTIER_BASE_URL` (https), `FRONTIER_MODEL`, `FPT_SECRET_FRONTIER_API_KEY` | variable, variable, secret | The external model is switched on at start when no AI settings are saved in the app. `FPT_FRONTIER_AUTO=0` turns this off. |
|
| 114 |
+
| `SUPABASE_BUCKET`, `SUPABASE_URL`, `SUPABASE_SERVICE_KEY`, `FPT_STATE_KEY` | variable and secrets | One bucket per deployment; never share a bucket between two instances (the last writer wins). |
|
| 115 |
+
|
| 116 |
+
If the start-up restore fails, the instance starts empty and **stops saving** (`/api/ready` shows `saved_state.paused`, and the app shows a notice) so the good
|
| 117 |
+
snapshot is not overwritten; restart to retry. The first save of every start keeps the archive it found as `state/previous.bin`
|
| 118 |
+
in the bucket; copy it over `state/latest.bin` to undo a bad save.
|
deploy/docker-compose.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
#
|
| 2 |
# cp .env.example .env (edit it) then: docker compose up -d
|
| 3 |
# Three containers: the application, Temporal (durable workflows) and Caddy (HTTPS). All customer data stays in the
|
| 4 |
# named volumes on this host: nothing is stored outside the customer's environment.
|
|
|
|
| 1 |
+
# Trio Co-Worker: single-tenant deployment for one customer environment.
|
| 2 |
# cp .env.example .env (edit it) then: docker compose up -d
|
| 3 |
# Three containers: the application, Temporal (durable workflows) and Caddy (HTTPS). All customer data stays in the
|
| 4 |
# named volumes on this host: nothing is stored outside the customer's environment.
|
desktop/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
{
|
| 2 |
"name": "fpt-desktop",
|
| 3 |
-
"productName": "
|
| 4 |
"version": "1.0.0",
|
| 5 |
-
"description": "Windows desktop shell for
|
| 6 |
"main": "src/main.js",
|
| 7 |
"author": "FPT pilot team",
|
| 8 |
"license": "UNLICENSED",
|
|
@@ -19,11 +19,11 @@
|
|
| 19 |
},
|
| 20 |
"build": {
|
| 21 |
"appId": "local.fpt.coworker",
|
| 22 |
-
"productName": "
|
| 23 |
"directories": { "output": "dist", "buildResources": "build" },
|
| 24 |
"files": ["src/**/*", "build/icon.png", "build/icon.ico", "package.json"],
|
| 25 |
"win": { "target": [{ "target": "nsis", "arch": ["x64"] }], "icon": "build/icon.ico", "signAndEditExecutable": false },
|
| 26 |
-
"nsis": { "oneClick": false, "perMachine": false, "allowToChangeInstallationDirectory": true, "createDesktopShortcut": true, "shortcutName": "
|
| 27 |
"forceCodeSigning": false
|
| 28 |
}
|
| 29 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "fpt-desktop",
|
| 3 |
+
"productName": "Trio Co-Worker",
|
| 4 |
"version": "1.0.0",
|
| 5 |
+
"description": "Windows desktop shell for Trio Co-Worker (loads the same web app). Mock app, not Oracle Fusion.",
|
| 6 |
"main": "src/main.js",
|
| 7 |
"author": "FPT pilot team",
|
| 8 |
"license": "UNLICENSED",
|
|
|
|
| 19 |
},
|
| 20 |
"build": {
|
| 21 |
"appId": "local.fpt.coworker",
|
| 22 |
+
"productName": "Trio Co-Worker",
|
| 23 |
"directories": { "output": "dist", "buildResources": "build" },
|
| 24 |
"files": ["src/**/*", "build/icon.png", "build/icon.ico", "package.json"],
|
| 25 |
"win": { "target": [{ "target": "nsis", "arch": ["x64"] }], "icon": "build/icon.ico", "signAndEditExecutable": false },
|
| 26 |
+
"nsis": { "oneClick": false, "perMachine": false, "allowToChangeInstallationDirectory": true, "createDesktopShortcut": true, "shortcutName": "Trio Co-Worker", "installerIcon": "build/icon.ico", "uninstallerIcon": "build/icon.ico" },
|
| 27 |
"forceCodeSigning": false
|
| 28 |
}
|
| 29 |
}
|
desktop/src/loading.html
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<!doctype html>
|
| 2 |
<html lang="en"><head><meta charset="utf-8">
|
| 3 |
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'self'">
|
| 4 |
-
<title>Starting
|
| 5 |
<body><div class="banner" role="note">MOCK APP, NOT ORACLE FUSION</div>
|
| 6 |
<main><h1>Starting the co-worker...</h1><p>Starting the local backend and waiting for it to be ready (or contacting the server).</p></main></body></html>
|
|
|
|
| 1 |
<!doctype html>
|
| 2 |
<html lang="en"><head><meta charset="utf-8">
|
| 3 |
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'self'">
|
| 4 |
+
<title>Starting Trio Co-Worker</title><link rel="stylesheet" href="settings.css"></head>
|
| 5 |
<body><div class="banner" role="note">MOCK APP, NOT ORACLE FUSION</div>
|
| 6 |
<main><h1>Starting the co-worker...</h1><p>Starting the local backend and waiting for it to be ready (or contacting the server).</p></main></body></html>
|
desktop/src/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
'use strict';
|
| 2 |
-
//
|
| 3 |
// local mode : spawns the project's venv Python -> FastAPI on a free 127.0.0.1 port, waits for /api/ready, kills it on quit
|
| 4 |
// remote mode: loads a shared backend URL entered in Settings
|
| 5 |
// Security: contextIsolation on, nodeIntegration off, sandboxed renderer, minimal preload bridge, CSP, external links in
|
|
@@ -151,7 +151,7 @@ function secureWebContents(wc) {
|
|
| 151 |
const WEB_PREFS = { preload: path.join(__dirname, 'preload.js'), contextIsolation: true, nodeIntegration: false, sandbox: true, webSecurity: true, spellcheck: false };
|
| 152 |
|
| 153 |
function createMainWindow() {
|
| 154 |
-
win = new BrowserWindow({ width: 1360, height: 900, minWidth: 380, title: '
|
| 155 |
icon: path.join(__dirname, '..', 'build', 'icon.png'), webPreferences: WEB_PREFS });
|
| 156 |
secureWebContents(win.webContents);
|
| 157 |
win.once('ready-to-show', () => win.show());
|
|
@@ -161,7 +161,7 @@ function createMainWindow() {
|
|
| 161 |
|
| 162 |
function openSettings(message) {
|
| 163 |
if (settingsWin) { settingsWin.focus(); return; }
|
| 164 |
-
settingsWin = new BrowserWindow({ width: 560, height: 560, title: '
|
| 165 |
secureWebContents(settingsWin.webContents);
|
| 166 |
settingsWin.loadFile(path.join(__dirname, 'settings.html'), { query: message ? { message } : {} });
|
| 167 |
settingsWin.on('closed', () => { settingsWin = null; });
|
|
@@ -186,7 +186,7 @@ async function connect() {
|
|
| 186 |
await win.loadURL(`${base}/`);
|
| 187 |
buildTray();
|
| 188 |
} catch (e) {
|
| 189 |
-
dialog.showErrorBox('
|
| 190 |
openSettings(String(e && e.message ? e.message : e));
|
| 191 |
}
|
| 192 |
}
|
|
@@ -194,7 +194,7 @@ async function connect() {
|
|
| 194 |
function buildTray() {
|
| 195 |
if (!tray) {
|
| 196 |
tray = new Tray(nativeImage.createFromPath(path.join(__dirname, 'tray.png')));
|
| 197 |
-
tray.setToolTip('
|
| 198 |
tray.on('click', () => { if (win) { win.show(); win.focus(); } });
|
| 199 |
}
|
| 200 |
const cfg = loadConfig();
|
|
|
|
| 1 |
'use strict';
|
| 2 |
+
// Trio Co-Worker desktop shell (Electron). Loads the SAME built web app the backend serves; no second UI codebase.
|
| 3 |
// local mode : spawns the project's venv Python -> FastAPI on a free 127.0.0.1 port, waits for /api/ready, kills it on quit
|
| 4 |
// remote mode: loads a shared backend URL entered in Settings
|
| 5 |
// Security: contextIsolation on, nodeIntegration off, sandboxed renderer, minimal preload bridge, CSP, external links in
|
|
|
|
| 151 |
const WEB_PREFS = { preload: path.join(__dirname, 'preload.js'), contextIsolation: true, nodeIntegration: false, sandbox: true, webSecurity: true, spellcheck: false };
|
| 152 |
|
| 153 |
function createMainWindow() {
|
| 154 |
+
win = new BrowserWindow({ width: 1360, height: 900, minWidth: 380, title: 'Trio Co-Worker (mock app, not Oracle Fusion)', show: false,
|
| 155 |
icon: path.join(__dirname, '..', 'build', 'icon.png'), webPreferences: WEB_PREFS });
|
| 156 |
secureWebContents(win.webContents);
|
| 157 |
win.once('ready-to-show', () => win.show());
|
|
|
|
| 161 |
|
| 162 |
function openSettings(message) {
|
| 163 |
if (settingsWin) { settingsWin.focus(); return; }
|
| 164 |
+
settingsWin = new BrowserWindow({ width: 560, height: 560, title: 'Trio Co-Worker settings', parent: win || undefined, webPreferences: WEB_PREFS });
|
| 165 |
secureWebContents(settingsWin.webContents);
|
| 166 |
settingsWin.loadFile(path.join(__dirname, 'settings.html'), { query: message ? { message } : {} });
|
| 167 |
settingsWin.on('closed', () => { settingsWin = null; });
|
|
|
|
| 186 |
await win.loadURL(`${base}/`);
|
| 187 |
buildTray();
|
| 188 |
} catch (e) {
|
| 189 |
+
dialog.showErrorBox('Trio Co-Worker', String(e && e.message ? e.message : e));
|
| 190 |
openSettings(String(e && e.message ? e.message : e));
|
| 191 |
}
|
| 192 |
}
|
|
|
|
| 194 |
function buildTray() {
|
| 195 |
if (!tray) {
|
| 196 |
tray = new Tray(nativeImage.createFromPath(path.join(__dirname, 'tray.png')));
|
| 197 |
+
tray.setToolTip('Trio Co-Worker (mock app, not Oracle Fusion)');
|
| 198 |
tray.on('click', () => { if (win) { win.show(); win.focus(); } });
|
| 199 |
}
|
| 200 |
const cfg = loadConfig();
|
desktop/src/settings.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8">
|
| 5 |
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self'; connect-src 'none'; form-action 'none'">
|
| 6 |
-
<title>
|
| 7 |
<link rel="stylesheet" href="settings.css">
|
| 8 |
</head>
|
| 9 |
<body>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="utf-8">
|
| 5 |
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self'; connect-src 'none'; form-action 'none'">
|
| 6 |
+
<title>Trio Co-Worker settings</title>
|
| 7 |
<link rel="stylesheet" href="settings.css">
|
| 8 |
</head>
|
| 9 |
<body>
|
docker-compose.temporal.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# Temporal dev server for
|
| 2 |
# volume) + bundled Web UI. Ports bound to loopback only. Started by `fpt.cmd temporal` / `fpt.cmd up`.
|
| 3 |
name: fpt-temporal
|
| 4 |
services:
|
|
|
|
| 1 |
+
# Temporal dev server for Trio Co-Worker (pilot). Single container: Temporal server (SQLite persisted in a named
|
| 2 |
# volume) + bundled Web UI. Ports bound to loopback only. Started by `fpt.cmd temporal` / `fpt.cmd up`.
|
| 3 |
name: fpt-temporal
|
| 4 |
services:
|
docs/design/UI-APPLE.md
ADDED
|
@@ -0,0 +1,486 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
> Note (24 Oct 2026): this is the design the app was built to on branch `trio-apple-ui`. The product is now named "Trio Co-Worker"; older documents in this folder keep the earlier name. Where the build differs from this text: Ask is a sidebar item that opens the Ask dock (the `Ctrl K` palette also opens it); there is no separate Ask page. See the build notes in the commit history.
|
| 2 |
+
|
| 3 |
+
# UI-APPLE: Trio Co-Worker, Apple-style desktop web UI
|
| 4 |
+
|
| 5 |
+
Status: design proposal for the lead's approval. Desktop web only (1280 px and wider; no phone or tablet work).
|
| 6 |
+
Supersedes the visual layer of `UI-MINIMAL.md` and the Fluent pass. Keeps every rule of `UI-REDESIGN.md` sections 9 (58 features) and 10 (test hooks).
|
| 7 |
+
|
| 8 |
+
- Clickable mockup: `mockup/index.html` (one file, no network requests, Inter embedded as base64, system font stack first). Open it, use the sidebar,
|
| 9 |
+
`Ctrl K`, the sign-in links, the "Approve all" button, and the small "Mockup controls" pill at the bottom (run stage and live-browser state).
|
| 10 |
+
`?theme=dark|light` forces a theme; otherwise it follows the system. Hash routes: `#signin`, `#signin/register`, `#home`, `#start`, `#runs`,
|
| 11 |
+
`#run/approve|testing|decide|result[/starting|live|reconnecting|masked|unavailable]`, `#report`, `#scenarios`, `#defects`, `#envs`, `#pod`,
|
| 12 |
+
`#reports`, `#ask`, `#settings/ai|users|auto|sched|stop`, `#palette`, `#kit`.
|
| 13 |
+
- Screenshots (1440x900, light and dark, Chromium): `shots/*.png`.
|
| 14 |
+
- Brand: `brand/BRAND.md` and the SVG/PNG assets. Build plan: `BUILD-PLAN.md`.
|
| 15 |
+
|
| 16 |
+
## 0. The decisions in one page
|
| 17 |
+
|
| 18 |
+
1. **Apple's layout grammar, not a skin.** Translucent sidebar, translucent toolbar that content scrolls under, inset grouped lists on a quiet grey page,
|
| 19 |
+
capsule controls, sheets for short tasks, a right inspector for details. Honest to the HIG: sidebars up to two levels (we use one), no critical actions at
|
| 20 |
+
the bottom, segmented controls for view switching in an inspector, a single prominent action per toolbar.
|
| 21 |
+
2. **One accent, system blue** `#0071e3` (white text 4.70:1). Green, orange and red are status only. Orange also means "waiting for you" and "practice pod",
|
| 22 |
+
so the two things a consultant must never miss share one warm colour.
|
| 23 |
+
3. **Type:** system stack first (`-apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display"`), then **Inter Variable** (self-hosted, OFL) so Windows and Linux
|
| 24 |
+
look intentional. Never bundle SF. 14 px body, 28 px large title, tracking tightens as size grows.
|
| 25 |
+
4. **Materials with a fallback.** `backdrop-filter` only on three surfaces (sidebar, toolbar, floating layers). Solid colours under `prefers-reduced-transparency`,
|
| 26 |
+
`forced-colors`, and when `backdrop-filter` is unsupported. Nothing nests blur on blur.
|
| 27 |
+
5. **Four-stage run, one live browser.** The Run workspace is a vertical stage list (Prepare, Approve, Testing/Decision, Result) beside a 456 px inspector
|
| 28 |
+
(Live, Steps, Screens, Report, Excel). The live browser has seven explicit states, each with its own words and controls.
|
| 29 |
+
6. **Honesty is a design element.** The environment switcher at the top of the sidebar always says "Mock app, not Oracle Fusion" (orange, shield) or
|
| 30 |
+
"Oracle Fusion pod" (blue, cloud). Every report line, sheet and run header repeats it. Hermes attribution appears only on answers Hermes gave.
|
| 31 |
+
7. **Calm motion.** 120/200/320 ms, three curves, one small overshoot (segmented thumb, switch). No motion on frequent actions beyond a 0.975 press scale.
|
| 32 |
+
8. **Brand:** product is now "Trio Co-Worker" with an original mark (three nodes, one closed line). See `brand/BRAND.md`.
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## 1. Research and what we adopt
|
| 37 |
+
|
| 38 |
+
### 1.1 Apple Human Interface Guidelines (read from developer.apple.com, via the site's JSON documentation endpoint)
|
| 39 |
+
|
| 40 |
+
The HIG pages are client-rendered, so a normal fetch returns only the title. Each page below was read through `developer.apple.com/tutorials/data/design/human-interface-guidelines/<page>.json`.
|
| 41 |
+
Quotes are paraphrased; numbers are exact.
|
| 42 |
+
|
| 43 |
+
| Page | What it says (relevant part) | What we do |
|
| 44 |
+
|---|---|---|
|
| 45 |
+
| [Sidebars](https://developer.apple.com/design/human-interface-guidelines/sidebars) | Sidebars float above content in the Liquid Glass layer; show at most two hierarchy levels; use succinct group labels; don't hide the sidebar by default but offer a show/hide control; "avoid putting critical information or actions at the bottom of the sidebar" because windows get moved; icons use the accent colour and should have a purpose | 264 px translucent sidebar, one level with two small group labels, a visible hide button in the toolbar, **only the user row at the bottom** (the environment switcher, the honesty cue, is at the top), accent-coloured icons, selected row = neutral fill (not a second colour) |
|
| 46 |
+
| [Toolbars](https://developer.apple.com/design/human-interface-guidelines/toolbars) | Three zones: leading (sidebar toggle, title), centre, trailing (search, More, one prominent action); no bezels on items; aim for at most three groups; keep titles short; no custom tinted backgrounds that fight the system effect; don't make a toolbar item the only way to reach a command; "avoid segmented controls in toolbars" appears in the search summary but the Segmented controls page prefers them for toolbar/inspector view switching | 56 px translucent toolbar: sidebar toggle, back link, title + one-line subtitle, then actions, then the search field. One primary action per page, kept in the page head (Home, Test runs) so the toolbar stays calm. Every toolbar command is also in the palette (`Ctrl K`) |
|
| 47 |
+
| [Materials](https://developer.apple.com/design/human-interface-guidelines/materials) | Liquid Glass is for the **controls/navigation layer**, not content; "use Liquid Glass sparingly"; content-layer elements use standard materials; choose materials by meaning not colour; thicker = more legible; vibrant foreground colours on materials; avoid quaternary labels on thin materials | Glass only for sidebar, toolbar, menus, palette, toasts, composer. Cards and lists are **opaque** (content layer). Label colours on materials are `label` / `label-2` only. No clear glass over rich media |
|
| 48 |
+
| [Color](https://developer.apple.com/design/human-interface-guidelines/color) | Don't rely on colour alone; don't hard-code system colours; use dynamic colours for their purpose; supply light, dark and increased-contrast variants; for primary actions put colour on the **background**, not on text/symbol; don't add colour to several controls at once; system blue sample RGB 0,136,255 (light) / 0,145,255 (dark) | Status is always dot + word. Primary action = blue **fill** with white text, one per screen. We use `#0071e3`, a deliberately deeper blue than system `#0088ff`, because `#0088ff` with white text is only 3.65:1. An `Increase contrast` variant is specified in 6.9 |
|
| 49 |
+
| [Typography](https://developer.apple.com/design/human-interface-guidelines/typography) | macOS built-in styles: Large Title 26/32, Title 1 22/26, Title 2 17/22, Title 3 15/20, Headline 13/16 bold, Body 13/16, Callout 12/15, Subheadline 11/14, Footnote 10/13; default size 13, minimum 10; avoid ultralight/thin/light; system font uses dynamic optical sizes (Text and Display merged) | Our scale (section 4) follows the same ladder shifted up for web and Windows density: 28/34, 22/28, 17/22, 15/20, 14/20, 13/18, 12/16, 11.5/14. Weights 400/500/550/600/650 only. Inter has an `opsz` axis, so `font-optical-sizing: auto` mimics SF's text/display switch |
|
| 50 |
+
| [Segmented controls](https://developer.apple.com/design/human-interface-guidelines/segmented-controls) | For closely related choices; about 5-7 segments in a wide interface; equal widths; don't mix text and images; nouns or noun phrases; **on macOS prefer a tab view in the main window and use a segmented control for view switching in a toolbar or inspector** | Segmented control for the inspector tabs (Live/Steps/Screens/Report/Excel), run filters, Approve/Skip, environment type. Page-level sections use the sidebar, not tabs. 5 or fewer segments everywhere |
|
| 51 |
+
| [Sheets](https://developer.apple.com/design/human-interface-guidelines/sheets) | Use sparingly; one at a time; pair Done with Cancel; macOS sheets are modal cards with rounded corners floating on the parent; reasonable default size, resizable only if useful; use a panel for repeated input | Sheets for: Start a test run (3 steps), Register a Fusion pod, sign-in details. Cancel always present. Never two sheets at once. The palette and the Ask dock are not sheets |
|
| 52 |
+
| [Motion](https://developer.apple.com/design/human-interface-guidelines/motion) | Purposeful motion; feedback brief and precise; "generally avoid adding motion to frequent UI interactions"; let people cancel motion; make motion optional | Motion table in 5.5. Frequent actions (row hover, button press, nav) get 120 ms colour/scale only. Larger motion (sheet, page enter, toast) is 200-320 ms and never blocks input |
|
| 53 |
+
| [Lists and tables](https://developer.apple.com/design/human-interface-guidelines/lists-and-tables) | Prefer lists for text; keep item text succinct; middle ellipsis when clipped; descriptive column headings, noun phrases, title-style capitalisation; macOS: click header to sort, resizable columns, striping only for wide multi-column tables | Inset grouped lists for browse-and-act, tables for compare. Sortable headers on Test runs, Defects, Scenarios. No striping (hairlines only); middle ellipsis for run refs and URLs |
|
| 54 |
+
| [Layout](https://developer.apple.com/design/human-interface-guidelines/layout) | Order by importance; align to aid scanning; group with space or separators; progressive disclosure; "avoid placing controls or critical information at the bottom of a window" on macOS; separate controls from content | Waiting-for-you first on Home; "Approve all" is **inside** the stage card, not pinned at the window bottom; the Ask composer is the one exception (a conversational input is expected at the bottom) |
|
| 55 |
+
| [Accessibility](https://developer.apple.com/design/human-interface-guidelines/accessibility) | WCAG AA: 4.5:1 up to 17 pt, 3:1 for 18 pt and up or bold; macOS control hit target default 28x28, minimum 20x20; macOS text 13 default / 10 minimum; Reduce Motion: tighten springs, replace x/y transitions with fades, avoid animating blurs; support full keyboard access | Section 7. Our targets: 32 default, 28 minimum, 40 for stage actions. All text 4.5:1 or better (checked, section 3.4); focus ring 3:1 |
|
| 56 |
+
| [SF Symbols](https://developer.apple.com/design/human-interface-guidelines/sf-symbols) | Nine weights match the system font weights; three scales relative to cap height; **prohibits using symbols, or images confusingly similar, in app icons, logos or trademarked use** | We cannot use SF Symbols on the web (Apple restricts them to Apple platforms; this is from Apple's licence terms as I know them and was not re-verified in this session). We draw/choose an open icon set whose stroke matches Inter at 14 px (1.7 px at 18 px), and the logo is original |
|
| 57 |
+
|
| 58 |
+
Not verified in this session: Apple's SF Pro font licence text (my understanding: SF is licensed for design mockups and Apple-platform apps, not for web
|
| 59 |
+
embedding, which is why we use the system stack and Inter); the Liquid Glass (macOS 26) pages beyond Materials, Sidebars and Toolbars; Apple's own
|
| 60 |
+
HIG numbers for corner radii (the Layout page says concentricity is covered on the Liquid Glass page, which I did not read).
|
| 61 |
+
|
| 62 |
+
### 1.2 Open-source references (licences checked on GitHub, 24 Oct 2026)
|
| 63 |
+
|
| 64 |
+
| Reference | Licence | Use | Verdict |
|
| 65 |
+
|---|---|---|---|
|
| 66 |
+
| [Mantine](https://github.com/mantinedev/mantine) 7 (in the app) | MIT | theming through `createTheme`, CSS variables, `styles`/`classNames` | **Keep.** All restyling goes through theme tokens + one CSS layer |
|
| 67 |
+
| [Tabler Icons](https://github.com/tabler/tabler-icons) (in the app, `@tabler/icons-react`) | MIT | 6,000+ outline icons, stroke adjustable | **Keep** as the icon set. Set `stroke={1.7}` at 18 px; the mockup's icons are hand-drawn in the same style (24 grid, round caps) to avoid a build step |
|
| 68 |
+
| [Lucide](https://github.com/lucide-icons/lucide) | ISC (checked in `LICENSE`) | closest to SF Symbols' proportions | Fallback if Tabler lacks a glyph. Not needed now |
|
| 69 |
+
| [Inter](https://github.com/rsms/inter) / `@fontsource-variable/inter` (in the app) | OFL-1.1 | UI fallback font; `opsz` + `wght` axes | **Keep**; the mockup embeds the Latin `opsz` subset (73 KB) |
|
| 70 |
+
| [Geist](https://github.com/vercel/geist-font) | OFL-1.1 | alternative sans | Not adopted: Inter is closer to SF's proportions and already shipped |
|
| 71 |
+
| [shadcn/ui](https://github.com/shadcn-ui/ui) | MIT | pattern library built on Radix + CSS variables; its "tokens as CSS variables, components own their styles" approach | **Pattern only.** We do not add Tailwind or Radix: Mantine already provides the primitives. We copy the idea of semantic tokens (`--background`, `--muted`, `--ring`) |
|
| 72 |
+
| [Radix Primitives](https://github.com/radix-ui/primitives) | MIT | accessible behaviour reference for menus, dialogs, tabs, switch, radio group | **Reference for ARIA behaviour** when checking Mantine components (roving tabindex, `aria-checked`, focus return) |
|
| 73 |
+
| [Sonner](https://github.com/emilkowalski/sonner) | MIT | toast stacking and motion | Reference for the toast spec (2 visible, bottom centre). Implementation stays Mantine Notifications |
|
| 74 |
+
| [cmdk](https://github.com/pacocoursey/cmdk) | no licence file reported by the GitHub API in this session (the repo is widely reported as MIT; treat as unverified) | command palette | **Pattern only**; build on Mantine `Modal` + `Combobox` logic, no dependency |
|
| 75 |
+
| [Linear](https://github.com/linear/linear) (SDK only, UI is closed) / Raycast / Things / Craft / Arc | UI not open | patterns: `g`-then-letter navigation, single-key shortcuts, command palette as front door, sidebar with few items, quiet colour | **Patterns adopted:** palette, `N` new, `[` toggles sidebar, `g h/r/s/d/e` go-to |
|
| 76 |
+
| [awesome-liquid-glass](https://github.com/carolhsiaoo/awesome-liquid-glass) (list), `liquid-glass-effect-macos`, `shuding/liquid-glass` | n/a (list) | SVG-filter "refraction" glass | **Rejected.** SVG `backdrop-filter` refraction works only in Chromium, fails in Safari/Firefox, and costs GPU. We use plain `backdrop-filter: blur() saturate()` |
|
| 77 |
+
| An open-source Apple-style CSS component kit | none found | | The search found only SwiftUI/Liquid Glass effect demos, no maintained macOS-style component CSS. So we write ours (about 400 lines of CSS in the mockup) |
|
| 78 |
+
|
| 79 |
+
### 1.3 Agent-run and test-run UIs (what to borrow)
|
| 80 |
+
|
| 81 |
+
| Product | Observed pattern | Borrow |
|
| 82 |
+
|---|---|---|
|
| 83 |
+
| OpenAI Operator ([launch post](https://openai.com/index/introducing-operator/), [TechCrunch](https://techcrunch.com/2025/01/23/openai-launches-operator-an-ai-Agent-that-performs-tasks-autonomously)) | A small window shows the agent's dedicated browser with explanations of each action; the user can take over at any time; the agent hands control back for login, payment, CAPTCHA; takeover is not screenshotted. (Wikipedia says Operator was retired in Aug 2025 and the later ChatGPT agent was removed in Aug 2026; single source, unconfirmed, so treat the product as history, not a dependency.) | Plain-language "Now: ..." line under the frame; **sign-in is hidden** ("Sign-in screen hidden. Passwords are never shown here.", already in `LiveView`); a person decides at the hand-off points. We deliberately do **not** offer takeover: the live view is view-only (existing rule) |
|
| 84 |
+
| [Browserbase live view](https://docs.browserbase.com/features/session-live-view) | Embed a read-only iframe from a per-session debug URL; one URL per tab; fetch the URL server-side when the user asks to watch; separate replay (HLS) for recordings | Confirms our model: live = view-only stream, recording = separate "Watch the recording". If a tab opens, show a tab switcher inside the frame chrome (future) |
|
| 85 |
+
| [Playwright trace viewer](https://playwright.dev/docs/trace-viewer) | Actions list with locator and duration; film strip of screenshots; before/action/after snapshots; console and network filtered by selected action; source line highlighted; Errors tab | Steps tab = actions list with duration and state; Screens tab = film strip of evidence per scenario; failure card shows expected vs actual and "See the failed screen". The engineering view (Technical report, admin) can link to the real trace |
|
| 86 |
+
|
| 87 |
+
---
|
| 88 |
+
|
| 89 |
+
## 2. Principles
|
| 90 |
+
|
| 91 |
+
1. **Every screen answers three questions in order:** what is this, what is its state, what do I do next. One primary action per screen.
|
| 92 |
+
2. **Content is opaque, controls are glass.** Lists and cards are solid; chrome (sidebar, toolbar, menus, palette, toasts) is translucent.
|
| 93 |
+
3. **A person decides.** Waiting-for-you is the loudest thing in the app: orange count in the sidebar, orange stage marker with a ring and a 1.5 px orange card outline.
|
| 94 |
+
4. **Say where it ran.** Practice versus Oracle Fusion on every page, every report line, every notification.
|
| 95 |
+
5. **Calm by default:** neutral grey surfaces, one blue, status as a dot plus a word, no coloured tiles except the status tint on the "waiting" icon tile.
|
| 96 |
+
6. **Plain language.** Sentence case, no jargon in headings, no arrows on buttons, names for actions that say what happens ("Approve all 79 and start testing").
|
| 97 |
+
7. **Keyboard-first and pointer-friendly:** everything reachable by Tab, palette for navigation, arrows in segmented controls and radio lists.
|
| 98 |
+
|
| 99 |
+
---
|
| 100 |
+
|
| 101 |
+
## 3. Tokens
|
| 102 |
+
|
| 103 |
+
All tokens are CSS custom properties on `:root`, redefined under `@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { ... } }` and
|
| 104 |
+
`:root[data-theme="dark"]`. Mantine's `data-mantine-color-scheme` is mapped onto the same variables (BUILD-PLAN section 2). Values below are exactly those in the mockup.
|
| 105 |
+
|
| 106 |
+
### 3.1 Colour
|
| 107 |
+
|
| 108 |
+
| Token | Light | Dark | Use |
|
| 109 |
+
|---|---|---|---|
|
| 110 |
+
| `--bg` | `#f5f5f7` | `#1c1c1e` | page / window |
|
| 111 |
+
| `--bg-base` | `#ececf0` | `#141416` | layer behind the sidebar material |
|
| 112 |
+
| `--bg-elev` | `#ffffff` | `#2a2a2d` | grouped lists, cards, sheets, inspector |
|
| 113 |
+
| `--bg-elev-2` | `#fbfbfd` | `#313134` | table header, review bar |
|
| 114 |
+
| `--mat-sidebar` | `rgba(240,240,244,.72)` | `rgba(46,46,50,.64)` | sidebar (with blur 28 px, saturate 180%) |
|
| 115 |
+
| `--mat-bar` | `rgba(245,245,247,.74)` | `rgba(28,28,30,.74)` | toolbar (blur 24 px) |
|
| 116 |
+
| `--mat-pop` | `rgba(255,255,255,.78)` | `rgba(48,48,52,.8)` | menus, palette, toasts, composer (blur 30-40 px) |
|
| 117 |
+
| `--mat-*-solid` | `#ececf0` / `#f5f5f7` / `#ffffff` | `#232326` / `#1c1c1e` / `#2c2c2e` | fallbacks (reduced transparency, `forced-colors`, no `backdrop-filter`) |
|
| 118 |
+
| `--fill` / `-2` / `-3` | `rgba(60,60,67,.08/.12/.18)` | `rgba(235,235,245,.10/.16/.24)` | secondary buttons, track of segmented control, hover, skeleton |
|
| 119 |
+
| `--sep` | `rgba(60,60,67,.13)` | `rgba(235,235,245,.13)` | hairlines between rows (0.5 px) |
|
| 120 |
+
| `--sep-strong` | `rgba(60,60,67,.22)` | `rgba(235,235,245,.26)` | input borders, unselected radio ring |
|
| 121 |
+
| `--label` | `#1d1d1f` | `#f5f5f7` | primary text |
|
| 122 |
+
| `--label-2` | `#636366` | `#a1a1a6` | secondary text, captions, table headers |
|
| 123 |
+
| `--label-3` | `#8e8e93` | `#6e6e73` | disabled and decoration only, never required text |
|
| 124 |
+
| `--ph` (placeholder) | `#70707a` | `#98989f` | input placeholder (4.5:1 or better) |
|
| 125 |
+
| `--accent` | `#0071e3` | `#0071e3` | primary fill, switch-free selection, focus |
|
| 126 |
+
| `--accent-hover` / `-press` | `#0077ed` / `#0062c4` | `#1a84f0` / `#0062c4` | |
|
| 127 |
+
| `--accent-text` | `#0066cc` | `#64a8ff` | links, plain buttons, "Watch live" |
|
| 128 |
+
| `--accent-soft` / `-soft-2` | `rgba(0,113,227,.10/.16)` | `rgba(10,132,255,.16/.26)` | selected table row, selected choice, info banner, "Oracle Fusion" chip |
|
| 129 |
+
| `--green` (text) / `--green-dot` / `--green-soft` | `#1d7a35` / `#34c759` / `rgba(52,199,89,.16)` | `#30d158` / `#30d158` / `rgba(48,209,88,.18)` | Ready, passed |
|
| 130 |
+
| `--orange` (text) / `--orange-dot` / `--orange-soft` | `#a85a00` / `#f59300` / `rgba(255,159,10,.17)` | `#ff9f0a` / `#ff9f0a` / `rgba(255,159,10,.18)` | Waiting for you, practice pod |
|
| 131 |
+
| `--red` (text) / `--red-dot` / `--red-soft` | `#d70015` / `#ff3b30` / `rgba(255,59,48,.12)` | `#ff7a72` / `#ff453a` / `rgba(255,69,58,.2)` | Not ready, failed, emergency stop |
|
| 132 |
+
| `--focus` | `#0071e3` | `#64a8ff` | focus ring |
|
| 133 |
+
| `--scrim` | `rgba(0,0,0,.28)` | `rgba(0,0,0,.5)` | behind sheets and palette |
|
| 134 |
+
|
| 135 |
+
Dark-mode elevation: page `#1c1c1e` < cards and inspector `#2a2a2d` < table header `#313134` < thumb of segmented control `#5e5e63`. Higher means lighter; the sidebar
|
| 136 |
+
material sits slightly lighter than the page and darker than cards. There is no pure black.
|
| 137 |
+
|
| 138 |
+
### 3.2 Why not the exact Apple system colours
|
| 139 |
+
|
| 140 |
+
System blue `#0088ff` fills fail white text (3.65:1) and `#0a84ff` (dark) 3.65:1. We use `#0071e3` (apple.com's own button blue, 4.70:1). Green, orange and red text use the
|
| 141 |
+
darker "accessible" variants for text on light (`#1d7a35`, `#a85a00`, `#d70015`) and the system dots (`#34c759`, `#f59300`, `#ff3b30`) for the 8 px status dot,
|
| 142 |
+
where 3:1 is enough.
|
| 143 |
+
|
| 144 |
+
### 3.3 Increase contrast (`prefers-contrast: more`)
|
| 145 |
+
|
| 146 |
+
`--sep` becomes `--sep-strong`; `--label-2` becomes `#48484a` (light) / `#c7c7cc` (dark); `--fill` +50% alpha; focus ring 3 px; borders 1 px on cards. Materials fall back to solid.
|
| 147 |
+
|
| 148 |
+
### 3.4 Contrast checks (computed with `tools/contrast.py`, WCAG relative luminance)
|
| 149 |
+
|
| 150 |
+
| Pair | Ratio | | Pair | Ratio |
|
| 151 |
+
|---|---|---|---|---|
|
| 152 |
+
| light label on page | 15.5 | | dark label on `#1c1c1e` | 15.6 |
|
| 153 |
+
| light label-2 `#636366` on white / page / sidebar (~`#e9e9ee`) | 6.0 / 5.5 / 4.95 | | dark label-2 on `#2a2a2d` / `#1c1c1e` | 5.6 / 6.6 |
|
| 154 |
+
| placeholder `#70707a` on white | 4.9 | | dark placeholder on `#2a2a2d` | 5.0 |
|
| 155 |
+
| white on accent `#0071e3` | 4.70 | | dark accent-text `#64a8ff` on `#2a2a2d` / `#1c1c1e` | 5.85 / 6.96 |
|
| 156 |
+
| accent-text `#0066cc` on white / page | 5.57 / 5.11 | | green `#30d158` on `#2a2a2d` | 7.1 |
|
| 157 |
+
| green `#1d7a35` on white | 5.4 | | orange `#ff9f0a` on `#2a2a2d` | 7.0 |
|
| 158 |
+
| orange `#a85a00` on white / on its soft tint | 5.1 / 4.5 | | red `#ff7a72` on `#2a2a2d` / on its tint | 5.5 / 4.7 |
|
| 159 |
+
| red `#d70015` on white / on its tint | 5.4 / 4.7 | | focus ring `#64a8ff` on `#1c1c1e` | 7.0 |
|
| 160 |
+
| focus ring `#0071e3` on page `#f5f5f7` | 4.3 | | dark `label-3` `#6e6e73` | decoration only |
|
| 161 |
+
|
| 162 |
+
Translucent materials were checked against the worst plausible backdrop (the page colour plus the radial wash). Not measured on a real display in other themes.
|
| 163 |
+
|
| 164 |
+
### 3.5 CSS variable block (copy into `apple.css`)
|
| 165 |
+
|
| 166 |
+
```css
|
| 167 |
+
:root {
|
| 168 |
+
--font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter Variable", system-ui, "Segoe UI", sans-serif;
|
| 169 |
+
--mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
|
| 170 |
+
--bg:#f5f5f7; --bg-base:#ececf0; --bg-elev:#fff; --bg-elev-2:#fbfbfd;
|
| 171 |
+
--mat-sidebar:rgba(240,240,244,.72); --mat-bar:rgba(245,245,247,.74); --mat-pop:rgba(255,255,255,.78);
|
| 172 |
+
--fill:rgba(60,60,67,.08); --fill-2:rgba(60,60,67,.12); --fill-3:rgba(60,60,67,.18);
|
| 173 |
+
--sep:rgba(60,60,67,.13); --sep-strong:rgba(60,60,67,.22);
|
| 174 |
+
--label:#1d1d1f; --label-2:#636366; --label-3:#8e8e93; --ph:#70707a;
|
| 175 |
+
--accent:#0071e3; --accent-hover:#0077ed; --accent-press:#0062c4; --accent-text:#0066cc; --on-accent:#fff;
|
| 176 |
+
--accent-soft:rgba(0,113,227,.10); --accent-soft-2:rgba(0,113,227,.16);
|
| 177 |
+
--green:#1d7a35; --green-dot:#34c759; --green-soft:rgba(52,199,89,.16);
|
| 178 |
+
--orange:#a85a00; --orange-dot:#f59300; --orange-soft:rgba(255,159,10,.17);
|
| 179 |
+
--red:#d70015; --red-dot:#ff3b30; --red-soft:rgba(255,59,48,.12);
|
| 180 |
+
--r-xs:6px; --r-sm:8px; --r-md:10px; --r-lg:14px; --r-xl:18px; --r-2xl:22px; --r-pill:999px;
|
| 181 |
+
--sh-card:0 0 0 .5px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04),0 2px 8px rgba(0,0,0,.03);
|
| 182 |
+
--sh-pop:0 0 0 .5px rgba(0,0,0,.1),0 2px 6px rgba(0,0,0,.08),0 16px 48px rgba(0,0,0,.18);
|
| 183 |
+
--ease:cubic-bezier(.22,1,.36,1); --ease-sheet:cubic-bezier(.32,.72,0,1); --ease-spring:cubic-bezier(.34,1.4,.64,1);
|
| 184 |
+
--d1:120ms; --d2:200ms; --d3:320ms; --focus:#0071e3;
|
| 185 |
+
}
|
| 186 |
+
```
|
| 187 |
+
Dark values: see `tools/build_mockup.py` (`DARK`) for the full list; they are the right-hand column of 3.1.
|
| 188 |
+
|
| 189 |
+
---
|
| 190 |
+
|
| 191 |
+
## 4. Type scale
|
| 192 |
+
|
| 193 |
+
| Style | Size / line | Weight | Tracking | Use |
|
| 194 |
+
|---|---|---|---|---|
|
| 195 |
+
| Large title | 28 / 34 | 650 | -0.024em | page title (`h1`) |
|
| 196 |
+
| Title | 22 / 28 | 650 | -0.020em | settings pane title |
|
| 197 |
+
| Headline | 17 / 22 | 600 | -0.016em | card and sheet titles, section heads |
|
| 198 |
+
| Subhead | 15 / 20 | 600 | -0.012em | toolbar title, stage titles (16), row titles (14.5/550) |
|
| 199 |
+
| Body | 14 / 20 | 400 | -0.006em | default |
|
| 200 |
+
| Callout | 13 / 18 | 400-500 | -0.004em | row subtitles, captions under controls, buttons (13.5) |
|
| 201 |
+
| Caption | 12 / 16 | 400 | 0 | hints, footers, table headers, honesty lines |
|
| 202 |
+
| Micro | 11.5 / 14 | 600 | 0 | sidebar group labels, badges (never uppercase except LIVE badge) |
|
| 203 |
+
| Stat number | 34 / 40 | 700 | -0.030em | Home stats, verdict word |
|
| 204 |
+
|
| 205 |
+
Tabular numerals (`font-variant-numeric: tabular-nums`) on counts, times, tables. Monospace only for run refs, URLs and code. Minimum text size 11.5 px (HIG minimum 10 pt on macOS).
|
| 206 |
+
Body is 14 px, not Apple's 13 pt, because web text at 100% zoom on Windows renders lighter and smaller than on macOS; the HIG says default size guidance is for system fonts, and Inter at 14 matches SF at 13 optically.
|
| 207 |
+
|
| 208 |
+
## 5. Space, shape, depth, motion
|
| 209 |
+
|
| 210 |
+
### 5.1 Spacing (8-pt grid)
|
| 211 |
+
4 / 8 / 12 / 16 / 24 / 32 / 40 / 48 / 56. Page gutter 40; section gap 32; card padding 20; list row 12x16 with 56 min height; toolbar 56; sidebar 264 (min 232, collapsible to 0);
|
| 212 |
+
inspector 456 (400 under 1180 px); content max width 960 (wide pages 1120); readable lede 62 ch.
|
| 213 |
+
|
| 214 |
+
### 5.2 Radii (continuous-corner feel)
|
| 215 |
+
6 (kbd, minor), 8 (menu items), 10 (fields, nav items, icon tiles, tap rows), 14 (banners, inner boxes), 18 (cards, grouped lists), 22 (sheets, palette), 999 (buttons, chips, segmented, search).
|
| 216 |
+
Rule of concentricity: inner radius = outer radius minus the padding between them, never less than 6. Browsers do not offer true squircles; the 18/22 radii plus a 0.5 px ring approximate it. The app icon uses a real superellipse path (n = 5).
|
| 217 |
+
|
| 218 |
+
### 5.3 Elevation
|
| 219 |
+
- Content layer: **no shadows on lists**; cards get a 0.5 px ring plus 1-2 px soft shadow (`--sh-card`).
|
| 220 |
+
- Floating layer (menus, palette, sheets, toasts): `--sh-pop` (ring + 2/6 + 16/48).
|
| 221 |
+
- Stage card waiting for you: 1.5 px orange outline + 24 px orange glow at 12%.
|
| 222 |
+
- Hero card (Home): the only gradient surface (accent to indigo mix) and a coloured shadow. One per app.
|
| 223 |
+
|
| 224 |
+
### 5.4 Materials
|
| 225 |
+
Sidebar: blur 28, saturate 180%, alpha .72; toolbar: blur 24; popovers 30-40. A radial wash behind the sidebar (blue top-left, violet bottom-left, 7-10% alpha) gives the material something to show.
|
| 226 |
+
Fallbacks per 3.1. Do not use `backdrop-filter` on scrolling lists or tables (performance), and never stack blurred layers except toast over page.
|
| 227 |
+
|
| 228 |
+
### 5.5 Motion
|
| 229 |
+
|
| 230 |
+
| Token | Value | Use |
|
| 231 |
+
|---|---|---|
|
| 232 |
+
| `--d1` 120 ms, `--ease` | hover, press (scale .975), colour | buttons, rows, nav |
|
| 233 |
+
| `--d2` 200 ms, `--ease` | fades, switch colour, menu in (scale .96 to 1, translateY -4) | menus, overlays fade-in, banners |
|
| 234 |
+
| `--d3` 320 ms, `--ease-sheet` | sheets (translateY 22 + scale .975 to 1), palette (-10), sidebar slide, page enter (translateY 6) | |
|
| 235 |
+
| `--ease-spring` 320 ms | segmented thumb, switch knob (one 4% overshoot) | |
|
| 236 |
+
| shimmer 1.4 s linear, pulse 1.8 s, LIVE blink 1.4 s | skeleton, "Testing" dot, LIVE badge | only while the state lasts |
|
| 237 |
+
|
| 238 |
+
**Reduced motion** (`prefers-reduced-motion: reduce`): all durations 1 ms, no transforms on enter, no shimmer or pulse (static dots), springs become fades. Page enter and sheet become instant opacity.
|
| 239 |
+
Never animate `backdrop-filter` or blur radii.
|
| 240 |
+
|
| 241 |
+
## 6. Components
|
| 242 |
+
|
| 243 |
+
| Component | Spec |
|
| 244 |
+
|---|---|
|
| 245 |
+
| **Sidebar** | 264 px, `--mat-sidebar`, inner hairline right edge. Brand row (30 px `favicon.svg`, name 14.5/650, org name 11.5 caption). **Environment switcher** (radius-10 fill, tile 26 px: orange shield "Local mock pod / Mock app, not Oracle Fusion" or blue cloud "Acme UAT 26C / Oracle Fusion pod"; chevrons; opens a menu). Nav: Home, Test runs (orange count capsule), Ask; group "Library": Scenarios, Defects, Reports; group "Setup": Test environments, Settings (admin). Row 32 px, radius 10, icon 18 px accent, selected = `--fill-2` + 600 weight. Kill indicator (red, only when engaged) above the user row. Bottom: user row (avatar 28, name, role) opens account menu (appearance, Settings, Sign out). Hide with the toolbar button or `[`. |
|
| 246 |
+
| **Toolbar** | 56 px, `--mat-bar`, 0.5 px bottom hairline. Left: sidebar toggle (icon button 32), back link (accent, only on detail pages), title 15/650 + one-line caption. Right: page actions, then search field (pill, 300 px, "Search or ask" + `Ctrl K` / `⌘K` hint by platform). Content scrolls under it. |
|
| 247 |
+
| **Buttons** | pill. Regular 32 (13.5/500), small 28, large 40 (14.5). Primary = accent fill, white 600; secondary = `--fill`; plain = accent-text on transparent (hover `--accent-soft`); destructive = `--red-soft` with red text, and solid red only for irreversible, confirmed actions (Engage kill switch). Disabled .42 opacity. Press = scale .975. Loading = spinner replaces icon, label stays. **One primary per screen.** |
|
| 248 |
+
| **Icon buttons** | 32 (28 small), circular hover fill, `aria-label` required, tooltip after 600 ms. |
|
| 249 |
+
| **Segmented control** | pill track `--fill`, 2 px inset, thumb `--bg-elev` (dark `#5e5e63`) with `--sh-seg`, 28 px segments, 13/500, sliding thumb 320 ms spring. 2 to 5 segments (counts allowed: orange for waiting). Roving tabindex, arrows move and select. |
|
| 250 |
+
| **Inset grouped list** | `--bg-elev`, radius 18, `--sh-card`. Rows min 56, padding 12x16, leading tile 36 (radius 10; neutral, or orange/green/red/blue soft with a glyph), title 14.5/550, subtitle 13 `--label-2`, trailing status or button, chevron for navigation. Hairline between rows inset 66 px when a leading tile exists. Hover `--fill`; whole row is the hit target. A group has an optional 13/600 `--label-2` header above and a 12 caption footer below. |
|
| 251 |
+
| **Table** | in a grouped card. Header 12 `--label-2`, 52 px rows, hairlines, sortable headers (aria-sort), selected row `--accent-soft`, row actions (ellipsis) appear on hover and focus-within, numbers tabular. No zebra. |
|
| 252 |
+
| **Text field** | 38 px, radius 10, 1 px `--sep-strong` inset border; hover darker; focus = 1.5 px accent + 4 px `--accent-soft-2` halo; error = red border + message below (12 px red). Label above (13/500), hint below (12 caption). Stacked fields in one group for sign-in (Apple-ID style), outline on the group when any field has focus. |
|
| 253 |
+
| **Switch** | 44x26, knob 22 with shadow, on = system green `#34c759` (green here means "on", the single exception to "green = status"; it is the platform's switch colour). |
|
| 254 |
+
| **Radio list / choice cards** | radio rows in a bordered group (decision), choice cards with 2 px accent border and `--accent-soft` when selected (sheet steps). `role="radio"`/`checkbox` with `aria-checked`. |
|
| 255 |
+
| **Chips and status** | status = 8 px dot + word (13/550, never colour alone). Chips: 22 px pill, 12/550, for environment (Practice orange with shield, Oracle Fusion blue with cloud), severity, signed-off state. |
|
| 256 |
+
| **Banner** | radius 14, soft tint, 18 px glyph, body 13.5. orange = reminder/practice, red = error with "Try again", blue = information. |
|
| 257 |
+
| **Sheet** | modal, 600 px (max 100vw-48), radius 22, `--bg-elev`, `--sh-pop`, scrim; header (20/650 title, 1-line sub), body scroll, footer: Cancel left, secondary and primary right. Focus lands on the dialog; Esc and scrim click cancel; focus returns to the opener. One at a time. 3-step progress as three 4 px bars. |
|
| 258 |
+
| **Menu / popover** | `--mat-pop`, radius 14, padding 6, items 32 px radius 8; hover/keyboard highlight = accent fill with white text (macOS convention); group labels 11.5/600; hairline dividers; opens from its trigger with a 200 ms scale-in; Esc closes; arrow keys move. |
|
| 259 |
+
| **Command palette** | `Ctrl/⌘ K` or the search field. 640 px, radius 22, `--mat-pop`, input 18 px; groups: Waiting for you (when empty), Go to, Test runs, Actions, then "Ask: ..." as the fallback. Selected row = accent fill. Footer: key hints and "Nothing changes until you confirm." Actions that change data (Approve) only navigate to the confirm UI. Implemented so that **Ask** still opens the existing `aside aria-label="Ask the co-worker"` dock (see BUILD-PLAN risks). |
|
| 260 |
+
| **Toast** | bottom centre, `--mat-pop`, radius 18, green check disc, one action ("Watch live", "View run"), 4.2 s, max 2 visible, `role="status"`. Used after: approve, decision, sign-off, pod saved, kill switch. Errors are never toasts; they are banners next to the cause. |
|
| 261 |
+
| **Empty state** | 56 px grey tile with a glyph, headline 17/600, one sentence (42 ch), one action. Copy always says what to do next. |
|
| 262 |
+
| **Skeleton** | rounded bars `--fill` with a 1.4 s shimmer; same row heights as real rows; `aria-busy="true"` on the region; replaced by the real content with a 200 ms fade. Never a bare spinner for more than 300 ms. |
|
| 263 |
+
| **Error state** | red banner at the top of the region: what failed, the likely reason, "Try again" (calls `refetch`). Technical detail behind "Show details". |
|
| 264 |
+
| **Progress** | 6 px capsule `--accent` on `--fill-2`, with `role="progressbar"`; text under it states done / total and time left. |
|
| 265 |
+
| **Live badge** | 22 px pill: LIVE (red, blinking dot), STARTING / PAUSED / ENDED (grey), RECONNECTING (orange). The word is always present (colour is not the signal). |
|
| 266 |
+
| **Browser frame** | 30 px chrome (three neutral dots, centred URL pill with a lock), 16:10.2 viewport, radius 14, hairline ring; state overlays use `--bg-elev` at 84% plus a 10 px blur. The frame is always light-chrome content (the test environment's page) even in dark mode. |
|
| 267 |
+
|
| 268 |
+
## 7. Accessibility
|
| 269 |
+
|
| 270 |
+
- **Contrast:** AA (4.5:1 text, 3:1 UI and large text) everywhere, checked in 3.4. Status never by colour alone. `prefers-contrast: more` variant in 3.3.
|
| 271 |
+
- **Focus ring:** 2 px solid `--focus` with 2 px offset on buttons, rows, nav, segmented segments, switches (3:1 against both themes). Text fields: accent border + 4 px halo. Menus/palette: the highlighted item is the focus. Never `outline: none` without a replacement. Mantine's `focusRing: 'auto'` is kept.
|
| 272 |
+
- **Targets:** 32 px default (HIG macOS default 28, minimum 20), 28 px small, 40 px stage actions; table rows are fully clickable.
|
| 273 |
+
- **Keyboard map** (single keys only when focus is not in a field; shown in the `?` sheet and the Glossary popover footer):
|
| 274 |
+
|
| 275 |
+
| Keys | Action |
|
| 276 |
+
|---|---|
|
| 277 |
+
| `Ctrl/⌘ K` | command palette (search, go to, actions, ask) |
|
| 278 |
+
| `/` | focus search (opens palette) |
|
| 279 |
+
| `N` | new test run (opens the Start sheet) |
|
| 280 |
+
| `[` | hide / show the sidebar |
|
| 281 |
+
| `G` then `H` / `R` / `S` / `D` / `E` / `P` | go to Home / Test runs / Scenarios / Defects / Test environments / rePorts |
|
| 282 |
+
| `Alt+1` / `Alt+2` / `Alt+3` | focus the stage list / the inspector tabs / the inspector content (run page) |
|
| 283 |
+
| `←` `→` | move inside a segmented control; `↑` `↓` inside menus, radio lists, palette |
|
| 284 |
+
| `Enter` / `Space` | activate; `Enter` on a table row opens it |
|
| 285 |
+
| `Esc` | close menu, palette, sheet; clear search |
|
| 286 |
+
| `?` | shortcuts sheet |
|
| 287 |
+
| `Ctrl/⌘ Enter` | submit the focused sheet or confirm card (never approves anything without a visible button) |
|
| 288 |
+
|
| 289 |
+
Approving, deciding, signing off and the kill switch have **no single-key shortcut** by design.
|
| 290 |
+
- **Screen readers:** landmarks `nav "Pages"`, `main`, `aside "Run details"`, `aside "Ask the co-worker"`; sidebar count has a visually hidden ", 2 waiting for you"; stage changes announced through a polite `role="status"` line ("Waiting for your approval: 79 scenarios"); the live view's overlay text is `role="status"`, the live "Now:" line is `aria-live="off"` (existing) so it does not chatter; toasts `role="status"`; tables have captions/`aria-label` and `aria-sort`; icon-only buttons have labels; progress has `aria-valuenow`.
|
| 291 |
+
- **Motion:** section 5.5. **Transparency:** `prefers-reduced-transparency`, `forced-colors` (Windows High Contrast: borders replace fills, `CanvasText` for text, `Highlight` for selection and focus), and missing `backdrop-filter` all fall back to solid.
|
| 292 |
+
- **Zoom:** layout tested conceptually to 200% (sidebar collapses via `[`; the inspector becomes a section below the stages under 1180 px logical width, already how REDESIGN planned it). Not tested on a real browser at 200%.
|
| 293 |
+
- **Language and tone:** reading level plain; no abbreviations without a gloss on first use (P2P is written "Procure-to-Pay" in UI; module codes appear only in test ids).
|
| 294 |
+
|
| 295 |
+
## 8. Shell and screens
|
| 296 |
+
|
| 297 |
+
### 8.0 Shell
|
| 298 |
+
Sidebar + toolbar as in section 6. Route to nav mapping: Home `/`; Test runs `/runs`, `/runs/new`, `/runs/:id`, `/runs/:id/:tab`, `/schedules`; Ask `/assistant`, `/assistant/:id`; Scenarios `/scenarios`;
|
| 299 |
+
Defects `/tickets`; Reports `/reports`; Test environments `/pods`; Settings `/admin` (and `/agents`, `/heal`, `/scripts`, `/learner`, `/audit`, `/admin/*`). The page `<title>` is "Page · Trio Co-Worker (practice pod, mock app)" while a practice pod is selected.
|
| 300 |
+
Global states: loading = skeleton rows inside the page (the shell never blanks); error = red banner; offline/"test environment down" = amber banner under the toolbar with "The test environment is not answering" (replaces the sidebar warning); emergency stop on = red row in the sidebar and a red banner at the top of Home and the run page.
|
| 301 |
+
|
| 302 |
+
### 8.1 Sign in, register, forgot, reset (`/login`, `/register`, `/forgot`, `/reset`)
|
| 303 |
+
- **Layout:** one centred 400 px column on a soft three-colour radial wash (blue, violet, green at 10-22% alpha; solid page colour in dark with 10-16% alpha), vertical centre. `app-icon.svg` 116 px, `h1` 28/650, one sentence, stacked fields group (Username, Password; Apple-ID style, 48 px rows), full-width primary 40 px, two text links, the orange honesty line with shield (`data-testid="mock-banner"` kept), version caption.
|
| 304 |
+
- **Content:** "Sign in to Trio Co-Worker" / "Your team's patch testing partner. It plans and runs the tests. You decide." Links: "Forgot your password?", "Create account". Honesty: "Practice environment. Mock app, not Oracle Fusion." (hidden on production deployments that have only Fusion pods; the line then reads "Connected to Oracle Fusion test pods.")
|
| 305 |
+
- **Register:** "Create your account" / "An administrator approves new accounts before you can sign in." Fields Username, Email, Password ("At least 12 characters"). Success: "Account requested" (`register-sent`). **Forgot:** "Reset your password"; success "Check your email" (`forgot-sent`). **Reset:** "Choose a new password"; success `reset-done` then back to sign in with a toast.
|
| 306 |
+
- **States:** submitting = button spinner, fields disabled; wrong password = red inline message under the group ("That username or password is not right. Try again.") and focus returns to Password; locked/disabled account = banner with "Ask an administrator"; network down = banner "Can't reach Trio Co-Worker. Check your connection." Labels "Username", "Password", button "Sign in" unchanged (tests).
|
| 307 |
+
- Keyboard: Enter submits; autocomplete attributes set; password reveal not offered.
|
| 308 |
+
|
| 309 |
+
### 8.2 Home: Patch readiness (`/`)
|
| 310 |
+
- **Head:** `h1` "Patch readiness" (e2e), lede "Oracle update 26C on the practice pod. Pod release checked 21 Oct at 13:12." Right: patch select (pill, `aria-label` "Patch"), environment select if needed (`aria-label` "Test environment"), primary **New test run** (exact name; opens the Start sheet, `?new=1` too). When something waits, the first waiting row's button is the stronger action visually but "New test run" stays the only `filled` button on the page.
|
| 311 |
+
- **Summary row (3 cards):** hero "1 of 4 areas ready" with a segmented bar and a plain sentence; "Waiting for you 2"; "Open defects 3, 1 critical". Numbers come from existing endpoints (`useRuns`, readiness, tickets).
|
| 312 |
+
- **Waiting for you** (hidden when empty): grouped list, each row names the action ("Approve 79 scenarios for Procure-to-Pay", "Decide 1 failure in Order-to-Cash"), orange icon tile, one supporting line, button ("Review scenarios", "Decide"). Row opens the run at the right stage.
|
| 313 |
+
- **Business areas:** one row per area: name, last finished verdict as dot + word (Ready / Not ready / Not tested yet), one sentence, trailing "Start a test run" for untested. `readiness-<MOD>`, `verdict-<MOD>`, `summary-<MOD>` kept.
|
| 314 |
+
- **What this patch changes:** one row with a blue info tile; opens the existing accordion/sheet content (button name "What this patch changes"), glossary link in the footer.
|
| 315 |
+
- **States:** loading = hero and rows skeleton; empty (no runs yet) = Business areas shows all "Not tested yet" and the hero reads "No areas tested yet" with the primary highlighted; error = banner "Couldn't load readiness. Try again." Practice versus Fusion: lede names the pod.
|
| 316 |
+
|
| 317 |
+
### 8.3 Start a test run (guided sheet; `?new=1`, `N`, palette, empty states)
|
| 318 |
+
**Four steps, same as today's `StartRunWizard` (Where, What, How, Review)**, in one sheet with a 4-bar progress and Back / Next / Cancel; the last button is **Start run** (the e2e clicks exactly that name). The mockup's sheet passes the repo's e2e locators for this flow (`New test run` in `main`, button `/Local mock pod/` with `aria-pressed`, checkbox `/Procure-to-Pay/` checked by default, radio "Quick simulation (no browser)", button `/Demo options/`, label "Scenarios that fail with a real defect", `Next`, `Start run`), tested with Playwright in light and dark.
|
| 319 |
+
1. **Where should I test?** "Step 1 of 4. Pick the test environment." Two kinds of choice (toggle buttons with `aria-pressed`): "**Local mock pod**: Practice environment. Mock app, not Oracle Fusion. Good for learning and rehearsal." (orange tile) and each enabled Fusion pod ("Acme UAT 26C: Oracle Fusion pod. Your test environment. Results count towards sign-off.", blue tile). Preselected from the sidebar switcher; pods that are not runnable show greyed with the server's reason. (The mock pod's name stays "Local mock pod"; "Practice environment" is its kind label.)
|
| 320 |
+
2. **What should I test?** Checkbox cards per business area, label "Procure-to-Pay (P2P)" (`area-<MOD>` kept), the area of the selected patch pre-ticked. Next disabled until one is ticked.
|
| 321 |
+
3. **How should I run it?** Radio cards "Quick simulation (no browser)" (`mode-quick`) and "Full browser run" (`mode-live`; disabled when browser runs are off, with the reason). On the mock pod a "Demo options" disclosure reveals "Scenarios that fail with a real defect", "Also run High-priority scenarios", and patch name; on Fusion pods "Watch the test live" replaces it.
|
| 322 |
+
4. **Ready to start?** A grouped summary (Where with its environment chip, What, How), then the honesty banner (orange on the mock pod, blue on Fusion): "This runs on ... What happens next: the agents scan the pod and the release notes, then pause and ask a consultant to approve the test cases. You will see each step on the run page."
|
| 323 |
+
Starting navigates to `/runs/:id` (no extra segment) and shows a toast "Test run started. The agents are preparing the scenarios." Errors (pod not runnable, kill switch on, no permission) show as a banner in the sheet and keep it open. While any sheet or the palette is open, the page behind is `inert` and `aria-hidden` (so role queries and screen readers see only the dialog; this is also what makes the e2e's single `/Local mock pod/` button unambiguous).
|
| 324 |
+
|
| 325 |
+
### 8.4 Run workspace (`/runs/:id`, `/runs/:id/:tab`): the heart
|
| 326 |
+
|
| 327 |
+
**Toolbar:** back "Test runs", title "Procure-to-Pay", caption "Update 26C · Local mock pod · started 13:12", **All details** menu (`data-testid="all-details"`, items in 8.4.6), **Cancel test run** (destructive, asks to confirm; `run.control`), search.
|
| 328 |
+
**Layout:** two columns. Left: scrolling stage column (max 680, centred). Right: inspector 456 px (solid `--bg-elev`, hairline left edge) with the segmented tabs and a scrolling pane. Under 1180 px the inspector narrows to 400; under 1100 it becomes a section after the stages.
|
| 329 |
+
|
| 330 |
+
#### 8.4.1 Run header (inside the stage column)
|
| 331 |
+
`h1` "Procure-to-Pay test run" (`run-title`), then a meta row: status dot + words (`run-status`: "Waiting for your approval" orange, "Testing, scenario 23 of 79" blue pulsing, "Waiting for your decision" orange, "Finished: Ready/Not ready/On hold" green/red/orange, "Stopped" grey/red), environment chip (`mock-banner`, "Practice environment" orange or "Oracle Fusion pod" blue), run type chip ("Full browser run" / "Quick simulation"), reference chip with copy icon (`run-id`, aria-label "Run reference r-7f3a2c, copy"; admin `temporal-link` appears here). `attention` reminder banner sits above the stages when set. Resume (secondary) shows when paused.
|
| 332 |
+
|
| 333 |
+
#### 8.4.2 Stages (numbered, vertical rail)
|
| 334 |
+
Marker 32 px: grey number (todo), accent number with a 5 px soft ring (current), orange number with orange ring (current and waits for a person), green check (done); the rail between markers turns green for done stages. Titles 16/600; a one-line summary for every stage; only the current stage has a card (`data-testid="run-guide"` + `data-stage` = prepare | approve | testing | judge | result | stopped on the card).
|
| 335 |
+
1. **Prepare** (done): "Chose 79 scenarios. See what each agent did" (opens the Team board `/runs/:id/workflow`). While running: three ticks (scouting, researching, designing) with a skeleton line.
|
| 336 |
+
2. **Approve the scenarios** (waiting): orange card. Headline "79 scenarios are ready to test", lede "A scenario is one business check. 75 of them cover something this update changes. 2 are new, written by the AI model, and passed a dry run on the practice pod." Actions: primary large **Approve all 79 and start testing** (`guide-approve-all`), secondary **Let me look at them first** (exact; expands the review inline, `scenario review`), plain **Download as Excel** (`excel-script`). Done summary: "Approved by Sai Anirudh at 13:13."
|
| 337 |
+
3. **Testing** (running): card "Running scenario 23 of 79", lede "You are asked only if one fails. Watch it on the right, or keep working. We will tell you when something needs you.", progress bar with "22 passed, 0 failed" and "About 14 minutes left" (`guide-progress`). Quick simulation shows `no-live-note`: "This is a quick simulation, so there is no browser to watch. Choose “Full browser run” next time to see the test live."
|
| 338 |
+
**Your decision** (waiting, renamed stage 3): see 8.4.5.
|
| 339 |
+
4. **Result:** see 8.4.6. Stopped runs replace stages 3-4 with the Stopped card (reason, "Carry on from where it stopped" for `run.control`).
|
| 340 |
+
Stage changes announce via a polite status line; focus moves to the new card's primary button only if focus was in the stage column or on `body`.
|
| 341 |
+
|
| 342 |
+
#### 8.4.3 Approvals (inline review and `/runs/:id/scenarios`)
|
| 343 |
+
- Inline review (from "Let me look at them first") shows grouped rows: group header (step name, "4 of 7 shown", plain link "Approve all 7 Requisition scenarios"), rows with title, caption ("Critical. Changed by the update." / "High. Written by the AI model, dry run passed at 11:23."), and an **Approve | Skip** segmented control (accessible names unchanged: "Skip Rejected requisition for this patch"), a sticky review bar ("4 of 79 approved" `review-count`, secondary "Approve the remaining 75", primary **Submit review**; `review-bar`, `approve_cases` payload unchanged). Filter tabs All / Changed by the update / Written by the AI model / Critical (segmented, with counts). "Approve all 1 unchanged" and "Unchanged (1)" keep their names. AI drafts show "Dry run passed" or "Not runnable: reason" (`dry-run`, `ai-not-runnable`).
|
| 344 |
+
- Full page `/runs/:id/scenarios` uses the same list at full width with the inspector showing the selected scenario's steps.
|
| 345 |
+
- After submit: toast "Approved 79 scenarios. Testing has started." with **Watch live**.
|
| 346 |
+
|
| 347 |
+
#### 8.4.4 Live browser panel (inspector tab Live; `/runs/:id/live`)
|
| 348 |
+
Header: scenario title (15/600) + one line "Procure-to-Pay › Requisition · Signed in as Buyer · scenario 23 of 79", state badge at right. "Now:" line (`live-action`, 13 px, play glyph) when active. Browser frame (`live-frame`), then controls row: **Pause view** (freezes the last frame client-side; the test keeps running), **Fullscreen**, right-aligned freshness caption ("Updated just now", "Last picture 8 s ago"). Honesty line (always): "Test data only. This is the test environment's browser, not your own session." Below: **Results so far** (last three, newest first, failed first with a red X, durations) and **Up next**. `live-view`, `live-title`, `live-frame`, `live-action`, `live-failure-banner`, `live-unavailable` kept.
|
| 349 |
+
|
| 350 |
+
| State | Trigger (existing data in `LiveView.tsx`) | Badge | Overlay (title / sentence) | Controls |
|
| 351 |
+
|---|---|---|---|---|
|
| 352 |
+
| **Starting** | `l.active` and no `frame_ts` yet | STARTING grey | "Starting the browser" / "This takes a few seconds. The first screen appears here." + indeterminate bar | all disabled |
|
| 353 |
+
| **Live** | `l.active`, frame arriving | LIVE red blinking | none; an orange ring shows the element being acted on | Pause view, Fullscreen |
|
| 354 |
+
| **Sign-in hidden** | `l.masked` | LIVE | lock tile, "Sign-in screen hidden" / "Passwords are never shown here."; Now line "Signing in (the sign-in screen is not shown)" | Fullscreen |
|
| 355 |
+
| **Reconnecting** | `l.active && l.stale`, or stream `onError` (retry after 2 s, existing) | RECONNECTING orange | spinner, "Reconnecting to the test browser" / "The test keeps running. We show the last picture we received." Caption "Last picture N s ago" | Fullscreen only. After 30 s: add a plain button "Reload the picture" (new, bumps `conn`) |
|
| 356 |
+
| **Paused for your review** | status waiting; `gate` approve or human_review | PAUSED grey | pause tile (orange), "Paused for your review" / "Testing starts after you approve the scenarios." or "Testing continues after you decide the failure." | disabled |
|
| 357 |
+
| **Preparing next batch** | not active, running, `everActive` | STARTING | "Preparing the next batch of scenarios" / "The browser opens when the scenarios start." | disabled |
|
| 358 |
+
| **Ended** | not active and not running | ENDED grey | check tile, "Testing has finished" / "Open the report for the results." plus **Watch the recording** link when saved | disabled |
|
| 359 |
+
| **Unavailable** | `l.available === false` | none | replaces the frame with an empty state (`live-unavailable`): "Live view is not available" + the server's `reason`; for quick simulations the fixed text (`no-live-note` wording); secondary action "New test run" | none |
|
| 360 |
+
| **No permission** | `!canWatch` | none | "Watching the test needs the consultant, QA approver or admin role." | none |
|
| 361 |
+
| **Failure seen** | `l.failed` or failed results | banner above frame | red banner `live-failure-banner`: "This step failed. Testing continues with the next scenario." + **See the failed screen** (modal) + **Open in failure review** | |
|
| 362 |
+
|
| 363 |
+
The frame never shows a spinner without words. View-only is stated, there is no click-through, no "take over".
|
| 364 |
+
|
| 365 |
+
#### 8.4.5 Failures and decisions (stage "Your decision"; `/runs/:id/failures`)
|
| 366 |
+
Orange card: "1 scenario failed. What should we do?", lede names the scenario and what went wrong in one sentence. **We expected | What happened** pair (red tint on the actual). Evidence strip: 112 px thumbnail of the failed screen, "Screen at the moment it failed", "Step 6 of 9 · 11:48:02", **See the failed screen**. Radio list (`guide-failure-<id>`): "Yes, this is a real defect" (preselected with a "Suggested" chip, caption "We raise a defect with the screen and steps attached. This scenario counts as failed."), "No, the test needs fixing" (self-heal proposes a corrected step), "It is flaky, run it again" (retries up to 3, owner select). Primary **Submit decision** (`guide-submit-decisions`; multiple failures use Back/Next and a final submit). Waiver for P2 priority and a note field live behind "Add a note or waive" (`gate.human_review`). After submit: toast naming the defect raised; stage 3 returns to Testing or moves to Result.
|
| 367 |
+
|
| 368 |
+
#### 8.4.6 Result and sign-off; All details menu
|
| 369 |
+
- **Result card:** verdict word 34/700 in status colour (Ready green, Not ready red, On hold orange; `decision-badge`, `data-rule`), one sentence why, five numbers (tested, failing, not run, defect raised, steps not covered; `process-summary`), primary **Open the report and sign off**, plain **Download the results (Excel)**, honesty caption "Tested on the practice pod. Mock app, not Oracle Fusion. Sign-off is yours to give." (`guide-result`).
|
| 370 |
+
- **Report page** (`/runs/:id/report`): back link "Test run", title "Procure-to-Pay report", lede names the environment; toolbar-row actions Share, Download PDF (`pdf-link`), More downloads menu (Markdown, HTML, run-summary.json, Excel); verdict card with five numbers (`exec-summary`); "Results by business process" table (`criteria`, steps with Matched / Waived with a note); open defects; HTML report iframe titled "<MOD> go/no-go report" (contains NOT ORACLE FUSION on practice); **Sign off** card (`signoff`: "Sign-off is yours to give. It records your name, the time and your comment in the audit log.", comment field, primary **Sign off this report**, plain **Audit details**). After sign-off the card becomes "Signed off by Sai Anirudh, 21 Oct 2026, 13:41" with a green shield tile, and the toolbar shows a "Signed off" chip.
|
| 371 |
+
- **All details menu:** Watch the test live · Screens · Scenarios · Failures · Team board · Report and sign-off · By business process · What the patch changes · Activity log · Add a note for the team · Excel test script · group "Engineering views (admin)": Coverage map, Data plan, Scripts, Technical report. Names "Activity log", "Scenarios", "Failures", "Report and sign-off" verbatim (e2e).
|
| 372 |
+
|
| 373 |
+
#### 8.4.7 Inspector tabs
|
| 374 |
+
- **Live:** 8.4.4. **Steps:** the selected scenario's steps as a numbered grouped list with state (done check, running spinner, next), plain-language text, duration; a caption "Steps are written in plain business language. The code behind them is in All details." **Screens:** film-strip cards per scenario with pass/fail word, step, "Watch the recording"; `proof-card`s, search field, pager, permission fallback text. **Report:** state of the report, primary "Open the report and sign off", PDF / Copy link. **Excel:** two rows: Test script, Results (`excel-script`). `?scenario=<id>` selects the scenario for Steps/Screens.
|
| 375 |
+
- Resizable by dragging the left edge (400 to 560); collapsible; remembered per user.
|
| 376 |
+
|
| 377 |
+
### 8.5 Test runs (`/runs`)
|
| 378 |
+
Head: title, lede, plain link "Scheduled runs", primary **New test run**. Segmented filter: All · Waiting for you (orange count) · Running (count) · Finished · Stopped (+ "Started by me" switch). Table in a grouped card: Test run (name + run type caption), State (dot + word), Where (environment chip), Started; row opens the run; ellipsis menu (Open, Report, Resume, Cancel) on hover/focus; `run-row-<id>` kept; sortable headers. Empty: "No test runs yet. Start one and the co-worker plans the scenarios for you." + primary. Footer "Showing 6 of 6 test runs." with pager when more. `?waiting=1` preselects the filter.
|
| 379 |
+
|
| 380 |
+
### 8.6 Scenarios (`/scenarios`)
|
| 381 |
+
Master-detail: table (Scenario with "Area › Step" caption, Priority, Origin, Last result) at left, inspector at right with the selected scenario's steps, Excel, "Show in a run". Filters (segmented): All, Changed by the update, Written by the AI model, Critical; search; Export Excel in the head. `aria-label="scenarios library"`. Empty and error states as 6. Edits are an admin/consultant action with audit entry (existing permissions).
|
| 382 |
+
|
| 383 |
+
### 8.7 Defects (`/tickets`)
|
| 384 |
+
Table (`aria-label="tickets"`): Defect (title + ID), Area, Severity chip, Status dot (Open orange, Fixed green, Waived grey), Raised, Test run link. Segmented: Open (count) · Fixed · Waived · All. Row opens a right inspector (evidence, steps, owner, link to run). Footer: "Defects stay in this list; they are not sent to another system unless an administrator turns that on." Empty: "No open defects. Nice."
|
| 385 |
+
|
| 386 |
+
### 8.8 Test environments (`/pods`)
|
| 387 |
+
Head with primary **Add a Fusion pod** (opens the sheet "Add an Oracle Fusion test pod": Pod name, Pod URL, Environment type segmented Test/UAT/SIT/Development, Modules chips, notes; banner "Sign-in details come next. Passwords go to the secrets vault and never reach an AI model."; "Production pods are refused" as lede). Cards in a 2-column grid, **clearly labelled by kind**:
|
| 388 |
+
- **Local mock pod:** orange chip with shield "Practice environment", name, URL, orange banner "Mock app, not Oracle Fusion. Use it to learn the co-worker and rehearse a run. Results never count as a Fusion sign-off.", connection dot + words, "Ready for test runs", **Test connection**.
|
| 389 |
+
- **Oracle Fusion pod:** blue chip with cloud "Oracle Fusion pod", environment type chip (UAT), release and modules, connection dot ("Connected, checked 12:58" / red "Connection failed, checked ...: reason"), "Sign-in details: P2P (set by Sai)...", buttons **Test connection** (`pod-test-result` line under the grid), **Sign-in details** (sheet with module, test username, test password; password never shown again), Enabled switch, default marker.
|
| 390 |
+
- A dashed "Register a Fusion pod" row at the end. `pod-<id>`, `data-kind` kept. Capture-screen API (#38) stays API-only; if a UI is added it lives in a card "..." menu.
|
| 391 |
+
|
| 392 |
+
### 8.9 Reports (`/reports`)
|
| 393 |
+
Grouped list (`aria-label="reports"`): leading tile coloured by verdict, "Procure-to-Pay, update 26C", "19 Oct, practice pod. 78 of 79 passed.", trailing verdict word and "Not signed off" / "Signed off" chip. Row opens `/runs/:id/report`. Filters: verdict, signed off, environment. Empty: "Reports appear here when a test run finishes."
|
| 394 |
+
|
| 395 |
+
### 8.10 Ask (`/assistant`, `/assistant/:id`) and the Ask dock
|
| 396 |
+
- **Page:** centred 760 px thread; user bubbles accent with white text (radius 20, tail corner 6), assistant answers in white cards with the product avatar (`favicon.svg` 32), answer **cards** inside bubbles (readiness card `chat-card-readiness`, run progress `chat-run-progress`, mock strip `chat-mock-strip`), each answer ends with a caption "Source: your latest test runs and defects." (`chat-source`). Proposed actions are **confirm cards** (`chat-confirm`, "Nothing changes until you confirm.", primary `chat-confirm-button`, Cancel; after: "Done · test run started" `chat-action-done`, or `chat-action-closed`). Composer: glass pill at the bottom, placeholder "Ask about a run, a defect or an area" (`assistant-input`), send button, context chip when scoped (`chat-context`, removable).
|
| 397 |
+
- **Hermes notice (honesty rule):** when Hermes answered, that answer's caption reads "Source: ... Answered by the Hermes assistant." and the composer caption reads "The Hermes assistant uses NVIDIA's AI model. Don't paste client data." When Hermes is off or did not answer, neither line appears and answers are the built-in cards. Settings › AI models has "Use the Hermes assistant for Ask" (switch) with the same disclosure. If Hermes is configured but unreachable: banner "The Hermes assistant isn't answering. Using built-in answers." and answers carry no Hermes line.
|
| 398 |
+
- **Dock:** `Ctrl K` palette's "Ask: ..." opens the existing `aside aria-label="Ask the co-worker"` (right side, 380 px, same bubbles, `chat-dock`, `chat-toggle`, `chat-new`). States: thinking (three dots), error banner with Try again, empty (suggested questions as plain-pill buttons).
|
| 399 |
+
|
| 400 |
+
### 8.11 Settings (admin; `/admin?tab=...` and the engineering routes)
|
| 401 |
+
Left list inside the page (selected = accent fill, macOS Settings style) and a 720 px pane: **AI models** (Local model: "Now: running on this machine. Nothing leaves your network." + Test; External model: key state + Save key / Remove; routing table "Which agent uses which model"; Ask assistant switch), **Users** (table with role select, status, create/approve), **Automatic approval** (switches with plain sentences; "Failures are always decided by a person."), **Schedules** (grouped rows with switch, Patch watch with "Check now"; create/delete), **Emergency stop** (red tinted group, "Stop all test runs now", destructive solid **Engage kill switch** then **Release**, `kill-state`; sidebar shows `kill-indicator`), and group "Under the hood": Audit log (filter + **Verify chain**, `audit-verify`), Agent team, Self-heal (approve/reject), Scripts and drafts (promote/discard), Learner. Each pane uses the grouped-list or table patterns above; destructive or irreversible changes confirm in a small sheet with the exact consequence in the first sentence. Non-admins do not see the Settings item.
|
| 402 |
+
|
| 403 |
+
### 8.12 Command palette and global search
|
| 404 |
+
Specified in section 6. Result groups and microcopy: "Waiting for you" (only when the query is empty), "Go to", "Test runs", "Actions", "Ask". Empty result: "Nothing matches." then the single row `Ask: "<query>"`. Footer: "Up Down to move · Enter to open · Nothing changes until you confirm."
|
| 405 |
+
|
| 406 |
+
### 8.13 Sidebar user menu and notifications
|
| 407 |
+
Menu: Appearance (cycles Match system / Light / Dark; the aria-labels "Switch to dark theme" / "Switch to light theme" stay), Settings, Sign out (aria-label "Sign out"). `whoami` is the user name. Desktop (Electron) adds "Desktop settings" and notifications through the existing `DesktopNotifier`.
|
| 408 |
+
|
| 409 |
+
---
|
| 410 |
+
|
| 411 |
+
## 9. Feature map: all 58 checklist items
|
| 412 |
+
|
| 413 |
+
Sidebar items: **Home, Test runs, Ask, Scenarios, Defects, Reports, Test environments, Settings**. "Run" = Run workspace (8.4), "Report" = `/runs/:id/report` (8.4.6), "Inspector" = right panel tab.
|
| 414 |
+
|
| 415 |
+
| # | Feature | Place in the Apple UI |
|
| 416 |
+
|---|---|---|
|
| 417 |
+
| 1 | Report and sign-off view | Report page `/runs/:id/report`; Result card primary; Inspector Report tab; All details menu |
|
| 418 |
+
| 2 | Sign-off form | Report page "Sign off" card (`signoff`, button "Sign off this report") |
|
| 419 |
+
| 3 | Download PDF | Report page toolbar row (`pdf-link`), Inspector Report tab, More downloads menu |
|
| 420 |
+
| 4 | Share (copy link) | Report page "Share"; Inspector Report "Copy link" |
|
| 421 |
+
| 5 | MD / HTML / run-summary.json downloads | Report page More downloads menu; Technical report (engineering views) |
|
| 422 |
+
| 6 | Criteria explanation (Audit details, C1-C6, exec summary, rule result) | Report page "Audit details" plain button, `criteria` table, `exec-summary`, `rule-result` |
|
| 423 |
+
| 7 | HTML report iframe | Report page lower section, iframe title "<MOD> go/no-go report" |
|
| 424 |
+
| 8 | Excel test script download | Approve card "Download as Excel" (`excel-script`), Inspector Excel tab, All details |
|
| 425 |
+
| 9 | Excel results download | Result card plain button, Inspector Excel tab |
|
| 426 |
+
| 10 | Screens / proof | Inspector Screens tab (`/runs/:id/proof` opens it) |
|
| 427 |
+
| 11 | Technical report + evidence list | All details > Engineering views > Technical report (`aria-label="evidence"`) |
|
| 428 |
+
| 12 | Delete this run's evidence (admin) | Technical report, destructive button with confirm sheet (`delete-evidence`) |
|
| 429 |
+
| 13 | Coverage map / Data plan / Scripts (admin) | All details > Engineering views |
|
| 430 |
+
| 14 | Live view (stream, pause, jump to live, fullscreen, failed-screen modal, results so far, up next, honesty line) | Inspector Live tab, states table 8.4.4; "Jump to live" appears in the controls when paused |
|
| 431 |
+
| 15 | Now testing line + Watch | the "Now:" line (`live-action`), status dot in the run header, Live tab badge |
|
| 432 |
+
| 16 | Workflow / agent states | Team board (`/runs/:id/workflow`, `/team` alias) from "See what each agent did"; All details > Team board |
|
| 433 |
+
| 17 | Agent team graph + stream mode | All details > Activity log (`stream-mode`) |
|
| 434 |
+
| 18 | Activity log + team notes | All details > Activity log; "Add a note for the team" menu item |
|
| 435 |
+
| 19 | Scenario review (approve/skip, approve all per step / unchanged / remaining, notes, submit, AI drafts, dry run, technical details) | Approve stage inline review and `/runs/:id/scenarios`, 8.4.3 |
|
| 436 |
+
| 20 | Approve all (one click) | Approve card primary (`guide-approve-all`) |
|
| 437 |
+
| 21 | Failure decision (three choices, suggestion, owner for flaky, back/next/submit) | "Your decision" stage card, 8.4.5 |
|
| 438 |
+
| 22 | Open all failure details (verdict, owner, waiver, note, submit) | `/runs/:id/failures` (All details > Failures), "Submit failure review" |
|
| 439 |
+
| 23 | What the patch changes (per run) | All details > What the patch changes (`change-*`) |
|
| 440 |
+
| 24 | By business process | All details > By business process (`business-progress`) |
|
| 441 |
+
| 25 | Next step banner | blue banner at the top of detail views (`next-step`) |
|
| 442 |
+
| 26 | Attention reminder | orange banner above the stages (`attention`) |
|
| 443 |
+
| 27 | Resume / Cancel test run | toolbar (Cancel test run), run header (Resume) with `run.control` |
|
| 444 |
+
| 28 | Run reference id copy | run header reference chip (`run-id`) |
|
| 445 |
+
| 29 | Temporal link (admin) | run header chip (`temporal-link`) |
|
| 446 |
+
| 30 | Chat command input (status, approve, cancel, report, screens, new) | Ask dock and Ask page composer; palette covers navigate-type commands |
|
| 447 |
+
| 31 | Patch readiness (selects, module cards, what changes, glossary, New test run) | Home, 8.2 |
|
| 448 |
+
| 32 | Start run wizard | Start sheet, 8.3 (+ "Use the full form") |
|
| 449 |
+
| 33 | Test runs list (filters, row menu, getting started, pager) | Test runs, 8.5 |
|
| 450 |
+
| 34 | Defects / tickets | Defects, 8.7 |
|
| 451 |
+
| 35 | Scenarios library | Scenarios, 8.6 |
|
| 452 |
+
| 36 | Reports page | Reports, 8.9 |
|
| 453 |
+
| 37 | Test environments (add pod, sign-in details, test connection, enabled) | Test environments, 8.8 |
|
| 454 |
+
| 38 | Screen capture (API only) | unchanged; future home: pod card "..." menu |
|
| 455 |
+
| 39 | Settings > AI models | Settings, AI models pane |
|
| 456 |
+
| 40 | Settings > Users | Settings, Users pane |
|
| 457 |
+
| 41 | Settings > Automatic approval | Settings, Automatic approval pane |
|
| 458 |
+
| 42 | Settings > Schedules (scheduler, patch watch) | Settings, Schedules pane; `/schedules`; link on Test runs |
|
| 459 |
+
| 43 | Emergency stop / kill switch | Settings, Emergency stop pane; red sidebar indicator (`kill-indicator`, `kill-state`) |
|
| 460 |
+
| 44 | Audit log (filter, verify chain) | Settings > Under the hood > Audit log (`audit-verify`) |
|
| 461 |
+
| 45 | Learner | Settings > Under the hood > Learner |
|
| 462 |
+
| 46 | Self-heal review | Settings > Under the hood > Self-heal |
|
| 463 |
+
| 47 | Scripts and drafts | Settings > Under the hood > Scripts and drafts |
|
| 464 |
+
| 48 | Agent team | Settings > Under the hood > Agent team |
|
| 465 |
+
| 49 | Chat page | Ask (`/assistant`, `/assistant/:id`); intake chips live in the Start sheet (`area-<MOD>`, `mode-quick`, `mode-full`) |
|
| 466 |
+
| 50 | Ask-a-question dock (Ctrl K), cards, confirm actions, context chip | Palette "Ask: ..." opens the dock; Ask page uses the same components |
|
| 467 |
+
| 51 | Sign in / register / forgot / reset | 8.1 |
|
| 468 |
+
| 52 | Dark mode toggle | Account menu "Appearance", aria-labels unchanged; follows the system by default |
|
| 469 |
+
| 53 | Sign out | Account menu (aria-label "Sign out") |
|
| 470 |
+
| 54 | Desktop notifications and Desktop settings | unchanged (Electron); Desktop settings in the account menu |
|
| 471 |
+
| 55 | Practice vs Fusion honesty cues | sidebar switcher (`mock-banner`), run header chip, report lines, pod cards, Start sheet banner, sign-in line, page title |
|
| 472 |
+
| 56 | Glossary popover | Home "What this patch changes" footer link and a help button in the run toolbar; keyboard sheet `?` |
|
| 473 |
+
| 57 | Health badge "test environment down" | amber banner under the toolbar (and a dot on the environment switcher) |
|
| 474 |
+
| 58 | Brand | sidebar brand row, sign-in (`brand` testid), page title, favicon (see `brand/BRAND.md`) |
|
| 475 |
+
|
| 476 |
+
## 10. Brand integration
|
| 477 |
+
Name "Trio Co-Worker" everywhere (BRAND.md section 6). Mark: `favicon.svg` in the sidebar (30 px), `app-icon.svg` on sign-in (116 px), `wordmark-*` in reports and README. The mockup embeds the real SVGs.
|
| 478 |
+
|
| 479 |
+
## 11. What I could not verify (honest list)
|
| 480 |
+
- HIG: read through Apple's JSON endpoint, not in a rendered browser; I did not read the "Liquid Glass" page (corner radii/concentricity) or Apple's SF font licence text. Apple font/symbol licence statements marked above are from memory.
|
| 481 |
+
- Rendered only in **Chromium on Windows** (Playwright), 1440x900. Not seen in Safari, Firefox, or on macOS with real SF Pro and real vibrancy. `backdrop-filter` support is Baseline in current browsers, from my knowledge, not re-checked in this session. Inter stands in for SF in all screenshots.
|
| 482 |
+
- No screen reader (NVDA/JAWS/VoiceOver) pass; keyboard flow was exercised by script only (Tab, Enter, Esc, arrows in palette, Ctrl K).
|
| 483 |
+
- Contrast numbers are computed from the token values, with translucent materials approximated against the page colour. `prefers-contrast`, `forced-colors` and `prefers-reduced-transparency` rules are specified, not rendered.
|
| 484 |
+
- Layouts under 1280 px, and 200% zoom, were not rendered (the mockup has one breakpoint at 1180 px, untested).
|
| 485 |
+
- The live-view states mirror `LiveView.tsx` logic by reading the code; I did not run the backend, so real frame timing, `stale` thresholds and the "Last picture N s ago" caption (needs `frame_ts` age; `stale` exists today, the age may need a backend field) are unconfirmed.
|
| 486 |
+
- Telegram/email notifications do not exist in the repo today (no matches), so those brand placements are for when they are built.
|
docs/design/UI-RESEARCH-RECOVERY.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UI research for the run page, live view, approvals and pod clarity
|
| 2 |
+
|
| 3 |
+
Written during the recovery of the Hugging Face demo (October 2026). It records what comparable products do, what we
|
| 4 |
+
took from them, and what is still a proposal. Only functional changes were made on `ui-fluent-fixes`; the visual
|
| 5 |
+
language is decided separately.
|
| 6 |
+
|
| 7 |
+
## 1. What comparable products do
|
| 8 |
+
|
| 9 |
+
| Product | What it shows | Source |
|
| 10 |
+
|---|---|---|
|
| 11 |
+
| Playwright trace viewer | One list of actions; for the selected action a before and after snapshot, a timeline you can hover, and its log, source, network, errors and console. The snapshot is a live DOM, not a picture. | https://playwright.dev/docs/trace-viewer-intro |
|
| 12 |
+
| Browserbase live view | The browser is an embedded frame with a small bar. It can be read-only (no pointer events) or interactive. It has an explicit "disconnected" state that the host page can react to, and one live view per tab. | https://docs.browserbase.com/features/session-live-view |
|
| 13 |
+
| OpenAI Operator | Three modes: the agent hands control back for sign-in and payment and does not capture the screen then (takeover), high-risk sites require the person to watch (watch mode), and the agent asks for approval before a significant final action (confirmation). | https://openai.com/index/introducing-operator/ (page blocked for our fetch; summarised from https://originality.ai/pt/blog/openai-operator and the system card https://cdn.openai.com/pdf/4375e605-f9a6-438d-bcc8-190599c183a6/o3_cua_system_card.pdf) |
|
| 14 |
+
| Anthropic computer use | Guidance, not a UI: run in an isolated VM or container, give it no sensitive logins, restrict the network to an allowlist, and ask a person to confirm actions with real-world consequences. Check before each action, not once per batch. Stop at the first failed action. The reference demo has a chat plus a screen of the container side by side. | https://platform.claude.com/docs/en/docs/agents-and-tools/tool-use/computer-use-tool |
|
| 15 |
+
| mabl | Step panel with the screenshot taken before the step, a Logs tab (activity, network, DOM), a timeline where a slow or auto-healed step is marked, a chat with the agent about a failure, and an exported PDF. | https://api.help.mabl.com/docs/browser-test-output, https://help.mabl.com/hc/en-us/articles/19083859201556 |
|
| 16 |
+
| Opkey, Testim | Public pages are mostly marketing. Opkey sends you to a Debug Info tab and failure screenshots, and heals through impact analysis in batches, not inside the run. Not verified further. | https://customerhub.opkey.com/support/solutions/articles/88000057990-test-execution-best-practices-and-remedies-for-common-errors |
|
| 17 |
+
|
| 18 |
+
## 2. Recommendations, and where we stand
|
| 19 |
+
|
| 20 |
+
Run page
|
| 21 |
+
1. One screen answers "what is happening and what do you need from me". Keep the current step, the one action that is
|
| 22 |
+
waiting for the person, and progress ("3 of 5 scenarios") above everything else. Status in words, never colour only. (Done in the current run guide.)
|
| 23 |
+
2. Every step is traceable: the list of actions on one side, the picture of that moment on the other, the log under it
|
| 24 |
+
(Playwright and mabl). We have the Screens, Steps and Activity tabs; a single combined step timeline is a proposal (P1).
|
| 25 |
+
3. State where the test runs, always, in words: "Oracle Fusion pod" or "Practice environment, mock app". Implemented on the
|
| 26 |
+
run header, the environment switcher, the pod cards, and now in the start flow (quick simulation never contacts a Fusion pod).
|
| 27 |
+
|
| 28 |
+
Live view
|
| 29 |
+
4. Every state is explicit (Browserbase): starting, live, paused for your review, hidden sign-in, reconnecting, finished,
|
| 30 |
+
unavailable with the reason. The new state is "taking longer than usual" after 60 seconds without a picture, instead of "Starting the browser" forever.
|
| 31 |
+
5. View only by default; a person never types into the test browser. Sign-in screens are not streamed (Operator's takeover
|
| 32 |
+
rule; we already mask password pages).
|
| 33 |
+
6. Show what the agent is doing in plain words next to the picture ("Now: ..."), already present.
|
| 34 |
+
7. Proposal (P2): a "browser could not open" state fed by the executor's exit status, so the page can show the real error instead of a timer.
|
| 35 |
+
|
| 36 |
+
Approvals
|
| 37 |
+
8. Ask before consequential actions only, and say what will happen (Operator, Anthropic). Our two gates (approve scenarios,
|
| 38 |
+
judge failures) are the right places; creating tickets stays human-confirmed. Approve-all in one click is kept, with the changed-by-patch scenarios first.
|
| 39 |
+
9. Proposal (P2): show the same confirmation inside the chat card and in the run header so a waiting gate is never missed.
|
| 40 |
+
|
| 41 |
+
Fusion and practice clarity
|
| 42 |
+
10. A real pod and the practice pod must never look alike. Full browser run is the default on a Fusion pod; the page states that
|
| 43 |
+
a simulation does not touch the pod. The Test environments page says which pods come from the server settings and survive a restart.
|
| 44 |
+
|
| 45 |
+
Monthly and quarterly cycles
|
| 46 |
+
11. A patch name is read as quarterly (26C) or monthly (2026-10); the readiness page lists the newest tested patch first and labels
|
| 47 |
+
the cadence; schedules can repeat monthly or quarterly on a chosen pod and patch. Proposal (P1): patch watch for Fusion pods
|
| 48 |
+
(it only reads the practice pod's release today), and a "this cycle vs last cycle" comparison on the readiness page.
|
| 49 |
+
|
| 50 |
+
## 3. Not done on purpose
|
| 51 |
+
- No visual change: colours, typography and layout are untouched on this branch.
|
| 52 |
+
- No interactive takeover of the test browser: it needs a trusted channel and is out of scope for the pilot.
|
docs/design/brand/BRAND.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Trio Co-Worker: brand
|
| 2 |
+
|
| 3 |
+
Status: proposal for approval. Replaces "Patch Testing Co-worker" / "FPT Co-worker" as the product name everywhere a person can see it.
|
| 4 |
+
All assets in this folder are original, hand-written SVG (generated by `../tools/gen_brand.py`). Nothing is copied from Apple, SF Symbols or any
|
| 5 |
+
other brand. Apple's HIG explicitly forbids using SF Symbols, or images confusingly similar to them, in app icons and logos, so the mark was
|
| 6 |
+
drawn from plain circles and lines.
|
| 7 |
+
|
| 8 |
+
## 1. The name
|
| 9 |
+
|
| 10 |
+
- **Spelling: "Trio Co-Worker"**. Capital T, capital C, capital W, hyphen, singular. Never "Trio Coworker", "TrioCoWorker", "Trio co-worker" (except
|
| 11 |
+
inside a running sentence, see below), "TRIO", or "Trio CW".
|
| 12 |
+
- In a sentence, after first use, "Trio" alone is fine ("Trio asks you before it starts testing"). Do not use "the Trio".
|
| 13 |
+
- Descriptor, when a line of explanation is needed: "patch testing for Oracle Fusion". Always lower case, never part of the name.
|
| 14 |
+
Do not write "Trio for Oracle", "Oracle Trio" or anything that implies Oracle makes or endorses the product.
|
| 15 |
+
- Why "Trio": three parties do the work together, the **consultant** (decides), the **AI agents** (plan, write, triage) and the **test browser**
|
| 16 |
+
(does the clicking on a real pod). The mark shows the same three.
|
| 17 |
+
- Legal line for About and report footers: "Trio Co-Worker is independent software. Oracle and Fusion are trademarks of Oracle Corporation."
|
| 18 |
+
(Oracle's name is used only to say which system is tested.)
|
| 19 |
+
|
| 20 |
+
## 2. The mark
|
| 21 |
+
|
| 22 |
+
Three round nodes joined by one closed line.
|
| 23 |
+
|
| 24 |
+
- The **top node has a ring** (a centre dot). It is the person: the one who decides. It is also the largest.
|
| 25 |
+
- The two lower nodes are the **AI agent** and the **test browser**.
|
| 26 |
+
- The line closes into a triangle: no part works alone, every hand-off is visible.
|
| 27 |
+
|
| 28 |
+
Files (all in this folder):
|
| 29 |
+
|
| 30 |
+
| File | Use |
|
| 31 |
+
|---|---|
|
| 32 |
+
| `app-icon.svg` (512, continuous-corner rounded square, blue gradient, white mark) | app icon, desktop app, sign-in screen, PWA, social card |
|
| 33 |
+
| `favicon.svg` (full-bleed variant, heavier strokes for 16 px) | browser tab (`<link rel="icon" type="image/svg+xml">`) and small UI (sidebar 28-32 px, chat avatar) |
|
| 34 |
+
| `favicon-16.png`, `favicon-32.png`, `favicon-48.png` | `<link rel="icon" sizes="...">` fallback, Windows shortcuts |
|
| 35 |
+
| `apple-touch-icon-180.png` (full bleed, no transparency; iOS applies its own mask) | `<link rel="apple-touch-icon">` |
|
| 36 |
+
| `icon-512.png` | PWA manifest, Electron `build.icon` source (convert to .ico/.icns in the desktop build), README social image |
|
| 37 |
+
| `logo-mark.svg`, `logo-mark-dark.svg` | bare mark in accent blue (light / dark surfaces) |
|
| 38 |
+
| `logo-mark-mono-black.svg`, `logo-mark-mono-white.svg` | one-colour print, Excel header image, fax-like contexts, watermarks |
|
| 39 |
+
| `wordmark-horizontal-light.svg` / `-dark.svg` | report headers, email header, README, docs |
|
| 40 |
+
| `wordmark-stacked-light.svg` / `-dark.svg` | sign-in, About, splash, slides |
|
| 41 |
+
|
| 42 |
+
The wordmark text is **outlined from Inter** (SIL OFL 1.1, free to use in a logo) so it renders the same in PDF, Excel, email and Telegram.
|
| 43 |
+
In the web UI itself the name is live text in the UI font stack next to `favicon.svg`, so it follows the user's font and the theme.
|
| 44 |
+
|
| 45 |
+
Wordmark rules: "Trio" in the primary label colour, "Co-Worker" in the secondary label colour, one weight (600-ish), no
|
| 46 |
+
all-caps, no tracking changes, no outline or shadow. Never set the name in two lines inside the horizontal lockup.
|
| 47 |
+
|
| 48 |
+
## 3. Colour
|
| 49 |
+
|
| 50 |
+
One accent, like the app: **Apple-style blue**.
|
| 51 |
+
|
| 52 |
+
| Role | Light | Dark |
|
| 53 |
+
|---|---|---|
|
| 54 |
+
| Accent (fills, the mark on light) | `#0071e3` (white text on it 4.70:1) | `#0071e3` for fills; mark and links use `#4da3ff` / `#64a8ff` |
|
| 55 |
+
| Accent text on white | `#0066cc` (5.57:1) | `#64a8ff` (5.85:1 on `#2a2a2d`) |
|
| 56 |
+
| App icon gradient | `#4aa3ff` to `#0062d6`, top to bottom, plus a 28% white highlight fading out by mid-height | same |
|
| 57 |
+
| Name text | `#1d1d1f` (Trio), `#636366` (Co-Worker) | `#f5f5f7`, `#a1a1a6` |
|
| 58 |
+
|
| 59 |
+
Rules:
|
| 60 |
+
- The blue is the **brand and the primary action**. Green, orange and red are status only (ready, waiting for you / practice pod, not ready).
|
| 61 |
+
Never colour the logo green, orange or red, and never use the logo to mean a status.
|
| 62 |
+
- On a photo or a busy background use the white mono mark on the app icon, not the coloured mark.
|
| 63 |
+
- Never put the coloured wordmark on the accent blue. Use the white mono mark and white text.
|
| 64 |
+
|
| 65 |
+
## 4. Clear space and size
|
| 66 |
+
|
| 67 |
+
- **Clear space** around the mark or lockup = the diameter of one lower node (x). Nothing (text, edge, other logo) inside that.
|
| 68 |
+
Around the app icon: 1/4 of its width.
|
| 69 |
+
- **Minimum sizes**: app icon 16 px (use `favicon.svg`/`favicon-16.png`, never a scaled-down `app-icon.svg`); bare mark 14 px; horizontal wordmark 96 px wide;
|
| 70 |
+
stacked 72 px wide. Below that, show the mark only.
|
| 71 |
+
- Do not rotate, stretch, recolour a single node, add a drop shadow to the bare mark, put the mark in a circle, or animate the nodes
|
| 72 |
+
except for the optional 1.2 s "loading" pulse (nodes scale 1 to 1.08 one after another, disabled under reduced motion).
|
| 73 |
+
|
| 74 |
+
## 5. Tagline
|
| 75 |
+
|
| 76 |
+
One line, plain English. Recommended first, used on the sign-in screen and README:
|
| 77 |
+
|
| 78 |
+
1. **"It tests. You decide."** (short, true to the approval model; use as the sign-in subtitle with a second sentence)
|
| 79 |
+
2. "Your Oracle patch testing partner."
|
| 80 |
+
3. "Quarterly patch testing, done with you."
|
| 81 |
+
4. "Test every patch. Sign off with confidence."
|
| 82 |
+
5. "You, the agents and a real browser, working as one."
|
| 83 |
+
|
| 84 |
+
Sign-in microcopy (used in the mockup): "Your team's patch testing partner. It plans and runs the tests. You decide."
|
| 85 |
+
|
| 86 |
+
Avoid: "AI-powered", "next-gen", "revolutionary", anything promising that the product replaces a human sign-off. Sign-off stays a person's.
|
| 87 |
+
|
| 88 |
+
## 6. Every place the name and logo must appear
|
| 89 |
+
|
| 90 |
+
The product name comes from one source of truth: `product_name` in `coworker/config.py` (env `FPT_PRODUCT_NAME`), served by `/api/ready` and read by the web
|
| 91 |
+
app (`useBrand`). Fallback strings in code must be changed too, so the name never flashes the old value.
|
| 92 |
+
|
| 93 |
+
| # | Place | What | Logo form |
|
| 94 |
+
|---|---|---|---|
|
| 95 |
+
| 1 | Sign-in, register, forgot, reset (`web/src/pages/AuthShell.tsx`) | heading "Sign in to Trio Co-Worker", tagline, `data-testid="brand"` kept | `app-icon.svg` 116 px above the heading |
|
| 96 |
+
| 2 | Sidebar brand row (`AppSidebar.tsx`) | "Trio Co-Worker" + org name | `favicon.svg` 30 px |
|
| 97 |
+
| 3 | Browser tab | `<title>`: "Trio Co-Worker" (+ page, + "practice pod, mock app" while a practice pod is selected) | `favicon.svg`, `favicon-32.png`, `apple-touch-icon` in `web/public/` and `web/index.html` |
|
| 98 |
+
| 4 | `web/index.html` meta description | "Trio Co-Worker. Patch testing for Oracle Fusion. Mock app, not Oracle Fusion." | |
|
| 99 |
+
| 5 | Report HTML bundle (`coworker/graph/nodes/report.py`, title and `<h1>` area) | header: wordmark; footer: "Generated by Trio Co-Worker v{version}. Tested on {pod}. {practice-pod line}" | `wordmark-horizontal-light.svg` inlined as data URI (reports must be self-contained) |
|
| 100 |
+
| 6 | Report PDF (`coworker/adapters/pdf.py`) | page header wordmark, footer text with page numbers and run reference | same, vector |
|
| 101 |
+
| 7 | Excel exports (`coworker/platform/test_script.py` and the results workbook) | "Read me" sheet: logo image top-left + "Trio Co-Worker"; replace the "Patch testing co-worker" cell; document property Creator = "Trio Co-Worker" | `logo-mark.svg` rendered to PNG at 2x for the sheet |
|
| 102 |
+
| 8 | Emails and notifications (none exist in the repo today; add when built) | subject prefix "[Trio Co-Worker]", header wordmark, footer line, plain-text fallback with the name | `wordmark-horizontal-light.svg` (PNG for mail clients that block SVG) |
|
| 103 |
+
| 9 | Desktop notifications (`web/src/desktop.ts`, Electron `DesktopNotifier`) and Electron `productName`/window title | title "Trio Co-Worker", body names the run | `icon-512.png` to .ico/.icns |
|
| 104 |
+
| 10 | Telegram / Hermes messages (Hermes integration) | first line "Trio Co-Worker:" then the sentence; bot name and photo = `icon-512.png`; the Hermes honesty line stays ("Answered by the Hermes assistant using NVIDIA's AI model") | `icon-512.png` as bot photo |
|
| 105 |
+
| 11 | Ask page and dock | assistant avatar, "Ask Trio" is not used: the box says "Ask about a run, a defect or an area" | `favicon.svg` 32 px |
|
| 106 |
+
| 12 | README (title and badge), `README.md` HF Spaces front matter `title:`, `coworker/README.md`, `deploy/DEPLOY.md` | "Trio Co-Worker" | horizontal wordmark at the top of README |
|
| 107 |
+
| 13 | API docs (`coworker/api/app.py`, FastAPI `title=`; Swagger/ReDoc pages) | "Trio Co-Worker API"; set `swagger_ui_parameters`/custom favicon via `/favicon.svg` | `favicon.svg` |
|
| 108 |
+
| 14 | CLI banner (`coworker/__main__.py`), launcher (`fpt.cmd` header comment), start script messages (`.devcontainer/start.sh`) | "Trio Co-Worker is up: URL" | text |
|
| 109 |
+
| 15 | Audit log and exported evidence (`generated_by` fields where a product name is recorded) | "Trio Co-Worker vX.Y" | text |
|
| 110 |
+
| 16 | Docs and design files (`docs/design/*.md` headings, mockup) | name only in new docs; do not rewrite history in old design docs | |
|
| 111 |
+
| 17 | Mock app / practice pod chrome | stays "Practice App": it is not our product and must not look like it | none |
|
| 112 |
+
|
| 113 |
+
## 7. Voice
|
| 114 |
+
|
| 115 |
+
Sentence case. Plain words ("test run", "scenario", "Waiting for you", "Approve"). No jargon in headings. One sentence of explanation, then the action.
|
| 116 |
+
Honesty first: always say practice pod versus Oracle Fusion, and always say who decides.
|
docs/design/brand/app-icon.svg
ADDED
|
|
docs/design/brand/favicon.svg
ADDED
|
|
docs/design/brand/logo-mark-dark.svg
ADDED
|
|
docs/design/brand/logo-mark-mono-black.svg
ADDED
|
|