Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/desktop/openadapt_desktop/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ def main(argv: list[str] | None = None) -> None:
p.add_argument(
"--admit-local",
action="store_true",
help="Sign a MockMed/local-dev admission that production trust maps refuse",
help="Sign a local-dev admission that production trust maps refuse",
)

# replay
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/openadapt_desktop/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def record_args(self, out_dir: Path, *, task: str = "") -> list[str]:
if self.backend == "web" and not self.url:
# Flow's interactive web recorder deliberately requires an exact
# URL. Its separate demo-record command is the canonical bundled
# MockMed quickstart, so keep Desktop's blank-URL path useful
# bundled quickstart demo, so keep Desktop's blank-URL path useful
# without inventing an implicit public URL.
return [
"demo-record",
Expand Down
80 changes: 42 additions & 38 deletions packages/flow/openadapt_flow/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- ``record`` — record a demonstration into the format ``compile`` consumes.
With no ``--backend`` and no ``--url``, capture the desktop on this OS.
``--url`` without ``--backend`` still records the browser.
- ``demo-record`` — serve MockMed locally and record the canonical demo.
- ``demo-record`` — serve the bundled demo locally and record the canonical demo.
- ``compile`` — compile a recording directory into a workflow bundle.
- ``induce`` — induce a parameterized PROGRAM bundle from MULTIPLE recordings
(multi-trace induction); refuses (nonzero exit) when intent is
Expand All @@ -24,7 +24,7 @@
capabilities (each child a ``QualificationAdmissionEnvelope``). Not compose.
``certify`` / ``run`` execute the parent; ``replay`` refuses it. The
launcher form is ``openadapt flow process``.
- ``replay`` — replay a bundle; serves the bundled MockMed demo app when no
- ``replay`` — replay a bundle; serves the bundled demo app when --demo-app is passed
``--url`` is given (with optional ``--drift`` to demonstrate healing).
``--worklist`` drives a program's loop over a CLI-supplied relation; effect
verification and API actuation are wired from ``--config`` / flags.
Expand All @@ -36,7 +36,7 @@
demonstration (induce + gate + validate the correction, promote only a
verified revision), writing an updated bundle. Refuses bad fixes.
- ``approve`` — mark a durably-paused run's pending escalation approved.
- ``bench`` — replay a bundle N times against MockMed and aggregate.
- ``bench`` — replay a bundle N times against the demo app and aggregate.
- ``visualize`` — SEE what a demonstration compiled into: emit a program-graph
view of a bundle or a composed parent (child bundles, --after DAG,
effect-bound handoffs) as self-contained HTML, Mermaid, or the shared JSON
Expand Down Expand Up @@ -282,7 +282,7 @@ def _resolve_record_capture_window(


def _with_drift(url: str, drift: str | None) -> str:
"""Append a ``?drift=...`` query to a MockMed base URL."""
"""Append a ``?drift=...`` query to a demo app base URL."""
if not drift:
return url
return f"{url.rstrip('/')}/?drift={drift}"
Expand Down Expand Up @@ -1109,7 +1109,7 @@ def _undo_run_target_problem(args: argparse.Namespace, workflow) -> Optional[str

Resolves ``--config`` and the backend flags the way replay does. A web
target with no URL and no attached browser would start the bundled
MockMed demo, so the undo would act on the demo and use up its approval.
bundled demo, so the undo would act on the demo and use up its approval.
"""
from openadapt_flow.backends.factory import _normalize_kind

Expand Down Expand Up @@ -1233,8 +1233,8 @@ def _replay_desktop(
) -> int:
"""Replay against a non-browser native/remote backend built by the factory.

No Playwright browser, no bundled MockMed, no session video — those are
web-only. ``--drift`` (a MockMed teaching aid) is refused. The backend is
No Playwright browser, no bundled demo app, no session video — those are
web-only. ``--drift`` (a demo teaching aid) is refused. The backend is
built from the resolved ``BackendConfig`` and the shared replayer wiring runs
exactly as it does for the web path. With ``rollback_plan``, a GUI
compensation starts from the run's start screen (the halt cleanup and its
Expand All @@ -1246,7 +1246,7 @@ def _replay_desktop(

if args.drift:
raise SystemExit(
"--drift only demonstrates healing on the bundled MockMed web demo; "
"--drift only demonstrates healing on the bundled web demo; "
f"it does not apply to the {backend_cfg.kind!r} backend."
)
try:
Expand All @@ -1268,7 +1268,7 @@ def _replay_desktop(
effect_verifier=effect_verifier,
api_actuator=api_actuator,
durable=durable,
# No MockMed drift here, so the deterministic structural rung is
# No demo drift here, so the deterministic structural rung is
# preferred exactly as in a non-drift web replay.
use_structural=True,
pixel_verify_enabled=pixel_verify_enabled,
Expand Down Expand Up @@ -1984,7 +1984,7 @@ def _cmd_record_desktop(args: argparse.Namespace, backend: str) -> int:

def _cmd_demo_record(args: argparse.Namespace) -> int:
from openadapt_flow.demo_driver import record_triage_demo
from openadapt_flow.mockmed.server import serve
from openadapt_flow.tutorial import serve_demo_app as serve

url, stop = serve(port=0)
try:
Expand Down Expand Up @@ -3115,7 +3115,7 @@ def _cmd_replay(args: argparse.Namespace) -> int:
)
if args.drift and not demo_app:
raise SystemExit(
"--drift only applies to the bundled MockMed demo app (--demo-app); "
"--drift only applies to the bundled demo app (--demo-app); "
"drift your own app for real."
)
if (
Expand All @@ -3125,7 +3125,7 @@ def _cmd_replay(args: argparse.Namespace) -> int:
):
raise SystemExit(
"replay needs a target: pass --url, set backend.url in --config, or "
"pass --demo-app to replay against the bundled MockMed demo app."
"pass --demo-app to replay against the bundled demo app."
)
refuse_unqualified_skill(bundle, target_url=url)

Expand All @@ -3137,7 +3137,7 @@ def run_on_page(page, *, entry_url: Optional[str]):
# The browser backend is built through the same factory as the
# desktop backends; the grounding / identity / deployment wiring and
# the run are shared (see _build_and_run_replayer). ``--drift`` (a
# MockMed teaching aid) forces the visual floor so the healing ladder
# demo teaching aid) forces the visual floor so the healing ladder
# is exercised instead of the structural rung resolving it.
backend = build_backend(backend_cfg, page=page)
held_backend.append(backend)
Expand Down Expand Up @@ -3215,12 +3215,12 @@ def run_on_page(page, *, entry_url: Optional[str]):

stop = None
if url is None and demo_app:
from openadapt_flow.mockmed.server import serve
from openadapt_flow.tutorial import serve_demo_app as serve

url, stop = serve(port=0)
url = _with_drift(url, args.drift)
drift_note = f" (drift: {args.drift})" if args.drift else ""
print(f"--demo-app: replaying against bundled MockMed{drift_note}")
print(f"--demo-app: replaying against bundled demo app{drift_note}")

video_dir = getattr(args, "record_video", None)
from playwright.sync_api import sync_playwright
Expand Down Expand Up @@ -4048,7 +4048,7 @@ def _cmd_run(args: argparse.Namespace) -> int:
``--dry-run`` / ``--explain`` print the coverage report and stop before
execution. Once admitted, it delegates to the shared executor (the same
backend / effect / actuation / durable runtime as ``replay``), with
``--drift`` (a MockMed-only teaching aid) forced off.
``--drift`` (a demo-only teaching aid) forced off.
"""
from openadapt_flow.composition import is_composition_artifact
from openadapt_flow.execution_profiles import (
Expand Down Expand Up @@ -5919,8 +5919,8 @@ def _cmd_bench(args: argparse.Namespace) -> int:
from openadapt_flow.bench import run_bench
from openadapt_flow.emit.skill import bundle_surface
from openadapt_flow.ir import Workflow
from openadapt_flow.mockmed.server import serve
from openadapt_flow.report import render_bench_report
from openadapt_flow.tutorial import serve_demo_app as serve

try:
surface = bundle_surface(Workflow.load(Path(args.bundle)))
Expand All @@ -5930,7 +5930,7 @@ def _cmd_bench(args: argparse.Namespace) -> int:
from openadapt_flow.cli_hints import command

print(
"BENCH REFUSED: bench replays a bundle against the bundled MockMed "
"BENCH REFUSED: bench replays a bundle against the bundled demo "
f"web app, and this bundle was recorded on {surface!r}. Measure it "
"on its own app with repeated "
f"`{command('run BUNDLE --config deploy.yaml')}`. Nothing was executed."
Expand Down Expand Up @@ -8792,7 +8792,7 @@ def _add_backend_flags(p: argparse.ArgumentParser) -> None:
default=None,
metavar="APP",
help=(
"Owner application for --backend macos (e.g. TextEdit). During "
"Owner application for --backend macos (e.g. MyApp). During "
"record this scopes Capture to that local app window; during "
"replay/run it overrides backend.macos_app."
),
Expand Down Expand Up @@ -9663,7 +9663,7 @@ def build_parser() -> argparse.ArgumentParser:

p = sub.add_parser(
"demo-record",
help="Serve MockMed and record the canonical triage demo",
help="Serve the bundled demo app and record the canonical demo",
allow_abbrev=False,
)
p.add_argument("--out", required=True, help="Recording output directory")
Expand All @@ -9673,7 +9673,7 @@ def build_parser() -> argparse.ArgumentParser:
help="Note text typed during the demo (recorded as a parameter)",
)
p.add_argument("--param-name", default="note", help="Parameter name for the note")
p.add_argument("--drift", default=None, help="Comma-separated MockMed drift modes")
p.add_argument("--drift", default=None, help="Comma-separated demo drift modes")
p.add_argument("--headed", action="store_true", help="Run the browser headed")
p.add_argument(
"--record-video",
Expand Down Expand Up @@ -10243,15 +10243,15 @@ def build_parser() -> argparse.ArgumentParser:
"--demo-app",
action="store_true",
help=(
"Serve the bundled MockMed demo app and replay against it (for a "
"Serve the bundled demo app and replay against it (for a "
"bundle recorded on it, such as the tutorial's)"
),
)
p.add_argument(
"--drift",
default=None,
help=(
"Comma-separated MockMed drift modes (theme,move,rename,modal) "
"Comma-separated demo drift modes (theme,move,rename,modal) "
"to demonstrate bounded drift resolution; only with --demo-app"
),
)
Expand Down Expand Up @@ -11040,15 +11040,15 @@ def build_parser() -> argparse.ArgumentParser:

p = sub.add_parser(
"bench",
help="Replay a bundle N times against MockMed and aggregate",
help="Replay a bundle N times against the bundled demo and aggregate",
allow_abbrev=False,
)
p.add_argument("bundle", help="Workflow bundle directory")
p.add_argument("--n", type=int, default=3, help="Number of iterations")
p.add_argument(
"--drift",
default=None,
help="Comma-separated drift modes forwarded to the MockMed URL",
help="Comma-separated drift modes forwarded to the demo URL",
)
p.add_argument("--run-root", required=True, help="Directory for per-iteration runs")
p.add_argument(
Expand All @@ -11064,7 +11064,7 @@ def build_parser() -> argparse.ArgumentParser:
"benchmark",
help=(
"Benchmark compiled replay vs. a Claude computer-use agent on "
"the MockMed triage task (agent arm needs an Anthropic API key "
"the bundled demo task (agent arm needs an Anthropic API key "
"and costs real money)"
),
allow_abbrev=False,
Expand Down Expand Up @@ -11576,7 +11576,7 @@ def build_parser() -> argparse.ArgumentParser:
q.add_argument(
"--admit-local",
action="store_true",
help="Sign a MockMed/local-dev admission that production trust maps refuse",
help="Sign a local-dev admission that production trust maps refuse",
)
q.add_argument("--replace", action="store_true", help="Replace an existing project")
q.add_argument("--out", default=None, help="Write the accepted proposal JSON")
Expand Down Expand Up @@ -11619,7 +11619,7 @@ def build_parser() -> argparse.ArgumentParser:
q.add_argument(
"--admit-local",
action="store_true",
help="Sign a MockMed/local-dev admission that production trust maps refuse",
help="Sign a local-dev admission that production trust maps refuse",
)
q.add_argument(
"--proposer",
Expand Down Expand Up @@ -13055,7 +13055,7 @@ def _repair_store_flag(rp: argparse.ArgumentParser) -> None:
p.add_argument(
"--seed-mockmed",
action="store_true",
help="Write the synthetic MockMed ok and banner-lie admissions",
help="Write the synthetic demo ok and banner-lie admissions",
)
p.add_argument(
"--config",
Expand Down Expand Up @@ -13084,7 +13084,7 @@ def _repair_store_flag(rp: argparse.ArgumentParser) -> None:
help=(
"Reward contract bundle directory (contract.json, "
"required_effects.json, forbidden_effects.json, oracle.json, "
"optional certificate.json). Defaults to the seeded MockMed "
"optional certificate.json). Defaults to the seeded demo "
"tier-2 bundle when --seed-mockmed is given."
),
)
Expand Down Expand Up @@ -13113,7 +13113,7 @@ def _repair_store_flag(rp: argparse.ArgumentParser) -> None:
"--seed-mockmed",
action="store_true",
help=(
"Write the synthetic MockMed reward bundles (tier-2 read-only "
"Write the synthetic demo reward bundles (tier-2 read-only "
"SQLite oracle with a calibrated synthetic certificate; tier-0 "
"screen dump)"
),
Expand Down Expand Up @@ -13406,9 +13406,9 @@ def _cmd_serve_execute(args: argparse.Namespace) -> int:

seeded = ()
if args.seed_mockmed:
from openadapt_flow.mockmed.execute_seed import demo_admissions
from openadapt_flow.tutorial import demo_execute_admissions

seeded = demo_admissions()
seeded = demo_execute_admissions()
return run_serve_execute(
data_dir=Path(args.data_dir) if args.data_dir else None,
host=args.host,
Expand Down Expand Up @@ -13439,16 +13439,20 @@ def _cmd_serve_reward(args: argparse.Namespace) -> int:
data_dir = Path(args.data_dir) if args.data_dir else default_data_dir()
contract = args.contract
seeded_paths: dict[str, Path] = {}
seeded_store: Optional[tuple[Path, Path]] = None
if args.seed_mockmed:
from openadapt_flow.execute.keys import (
fingerprint_of,
load_or_create_private_key,
)
from openadapt_flow.reward.seed import seed_mockmed
from openadapt_flow.tutorial import seed_demo_reward

key = load_or_create_private_key(data_dir)
issuer_key_id = "self_signed:" + fingerprint_of(key.public_key())
seeded_paths = seed_mockmed(data_dir, key, issuer_key_id)
seeded_paths, store_db, store_screen = seed_demo_reward(
data_dir, key, issuer_key_id
)
seeded_store = (store_db, store_screen)
if contract is None:
contract = str(seeded_paths["tier2"])
if contract is None:
Expand All @@ -13470,9 +13474,9 @@ def _cmd_serve_reward(args: argparse.Namespace) -> int:
print(f" {REWARD_NOTICE}")
for label, path in seeded_paths.items():
print(f" seeded {label:<6} {path}")
if seeded_paths:
print(f" store {data_dir / 'mockmed' / 'records.db'}")
print(f" screen {data_dir / 'mockmed' / 'screen.json'}")
if seeded_store is not None:
print(f" store {seeded_store[0]}")
print(f" screen {seeded_store[1]}")
print(
" Register each episode with POST /v1/episodes BEFORE the "
"rollout runs. A required effect asserts a change, so the worker "
Expand Down
2 changes: 1 addition & 1 deletion packages/flow/openadapt_flow/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class SystemOfRecordBackend(Protocol):
write actually reached the system of record — a partial save, a phantom
optimistic-UI success, a duplicate submission all look identical on screen
(``docs/LIMITS.md`` "5 of 7 write faults silent"). A backend that can read
the app's authoritative store (a JSON ``/api/db`` endpoint, an EMR's own
the app's authoritative store (a JSON records endpoint, an app's own
API) exposes it here; the recorder snapshots it before and after each event
(``sor_before`` / ``sor_after`` on the event, exactly as it already records
``url_before`` / ``url_after``), and the compiler's effect miner
Expand Down
2 changes: 1 addition & 1 deletion packages/flow/openadapt_flow/backends/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def build_backend(
if not cfg.macos_app:
raise ValueError(
"backend.kind 'macos' requires backend.macos_app "
"(e.g. --macos-app TextEdit)"
"(e.g. --macos-app MyApp)"
)
from openadapt_flow.backends.macos_backend import MacOSBackend

Expand Down
2 changes: 1 addition & 1 deletion packages/flow/openadapt_flow/backends/parallels_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def snapshot(self, name: str, description: str = "") -> str:
"""Create a snapshot and return its id.

Snapshots are the drift-reset and warm-boot mechanism: every run
reverts to a clean ``opendental-ready`` state in seconds.
reverts to a clean ``app-ready`` state in seconds.
"""
args = ["snapshot", self.uuid, "-n", name]
if description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ class _FramePoint:

# Page-structure identity of a FORM FIELD that sits in no record row.
#
# A data-entry form (OpenEMR's new-patient page, most CRUD screens) lays its
# A data-entry form (most CRUD screens) lays its
# fields out in label/control groups (``.form-group.row`` and the like), not
# table rows, so the row rule above abstains and identity used to fall to the
# OCR band read across the field's visual row. This mirrors that band in the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2129,7 +2129,7 @@ def _window_guard(user32: Any, hwnd: int, point: tuple[int, int]) -> None:
"""Refuse a native action that the target's window could not take.

Checked with Win32 because UI Automation's own hit test passes through
windows that are still loading (seen live with Notepad over the app):
windows that are still loading (seen live with an auxiliary window over the app):
the window under the point must belong to the target's top-level
window, and that window and the target's must be enabled. A window a
modal dialog has disabled would drop the action without a word.
Expand Down
Loading
Loading