Team · hosted control plane
-
Shared workspaces, member roles and named seats
+
Hosted organizations, member roles and named seats
Organizations, invitations, roles, named seats, scoped device credentials and team audit run in Engraphis Cloud. This local dashboard stays single-user.
Checking local connection state…
diff --git a/engraphis/dashboard_assets/ledger.js b/engraphis/dashboard_assets/ledger.js
index 89031df5a..cc7fbbf04 100644
--- a/engraphis/dashboard_assets/ledger.js
+++ b/engraphis/dashboard_assets/ledger.js
@@ -117,7 +117,7 @@
const button = (label, className, action) => {
const control = node('button', className, label);
control.type = 'button';
- control.addEventListener('click', action);
+ if (action) control.addEventListener('click', action);
return control;
};
const memoryMutationButton = (label, className, action) => {
@@ -6621,23 +6621,31 @@
target.append(actions);
}
+ async function copyCloudSyncKey(key) {
+ try {
+ if (!navigator.clipboard) throw new Error('clipboard unavailable');
+ await navigator.clipboard.writeText(key);
+ showNotice('Cloud Sync key copied.');
+ return true;
+ } catch (_) {
+ showNotice('Copy failed. Select the key and copy it manually.');
+ return false;
+ }
+ }
+
function renderCreatedSyncKey(target, key, status) {
target.replaceChildren(
node('h3', '', 'Cloud Sync key created'),
node('p', 'automation-policy-note',
- 'Store this key somewhere safe. It is shown only once, and every device that syncs this workspace needs it.'),
+ 'Store this key somewhere safe. It is shown only once, click Copy key to copy it to your clipboard, and every device that syncs this workspace needs it.'),
node('code', 'sync-key-value', key),
);
const actions = node('div', 'automation-policy-actions');
- actions.append(button('Copy key', 'primary-button', async () => {
- try {
- if (!navigator.clipboard) throw new Error('clipboard unavailable');
- await navigator.clipboard.writeText(key);
- showNotice('Cloud Sync key copied.');
- } catch (_) {
- showNotice('Copy failed. Select the key and copy it manually.');
- }
- }));
+ const copyBtn = button('Copy key', 'primary-button');
+ copyBtn.addEventListener('click', () => {
+ copyCloudSyncKey(key);
+ });
+ actions.append(copyBtn);
actions.append(button('I stored the key', 'secondary-button', () => renderSyncStatus(status)));
target.append(actions);
}
@@ -6753,7 +6761,7 @@
const plans = [
{ id: 'free', name: 'Free', price: prices.free, note: 'The complete local memory engine and every core operation.', action: 'Current local plan' },
{ id: 'pro', name: 'Pro', price: prices.pro, note: 'Cloud sync, managed automation and portfolio analytics.' },
- { id: 'team', name: 'Team', price: prices.team, note: 'Shared workspaces, member roles, seats and remote agents.' },
+ { id: 'team', name: 'Team', price: prices.team, note: 'Hosted organizations, member roles, seats and scoped agent credentials.' },
];
plans.forEach(plan => {
const card = node('article', `plan-card${plan.id === 'pro' ? ' featured' : ''}`);
diff --git a/engraphis/routes/memory.py b/engraphis/routes/memory.py
index 290cadf8e..ab3bf5bab 100644
--- a/engraphis/routes/memory.py
+++ b/engraphis/routes/memory.py
@@ -874,15 +874,18 @@ async def get_license():
This surface used to hardcode ``plan: "local", features: []``. That describes the
*local core*, not the customer: a paying Team installation was told it was on the free
plan here while ``/api/license`` reported Team, so two endpoints of one product
- disagreed about what had been bought. The response keys are unchanged — this stays the
- legacy ``{"data": ...}`` SDK shape with the same trial and grace disclosure — and only
- the two fields that were lying now tell the truth.
+ disagreed about what had been bought. The legacy ``{"data": ...}`` SDK shape and the
+ existing ``trial_seconds``/``grace_seconds`` fields are preserved alongside the additive
+ ``trial_days`` and ``days_by_plan`` fields: ``trial_days`` keeps its historical Pro-only
+ integer meaning for clients that already read it, and ``days_by_plan`` is what discloses
+ a longer Team trial.
Resolution is local and non-blocking (see ``v2_api._plan_entitlement``): no network
call happens on this path, and an unconnected installation still reports ``local``
with no features, exactly as before. The plan stays presentation only; Engraphis Cloud
remains the sole authority for every paid operation.
"""
+ from engraphis.commercial import trial_days_by_plan
from engraphis.routes.v2_api import hosted_plan_summary
summary = hosted_plan_summary()
@@ -891,6 +894,11 @@ async def get_license():
"features": summary["features"],
"cloud_managed": True,
"trial_seconds": licensing.TRIAL_SECONDS,
+ # ``trial_days`` keeps its Pro-only legacy meaning; the per-plan map is what tells a
+ # Team reader their trial is longer. Emitting only the legacy value made every
+ # legacy client quote a 7-day Team trial.
+ "trial_days": licensing.TRIAL_DAYS,
+ "days_by_plan": trial_days_by_plan(),
"grace_seconds": licensing.MAX_HOSTED_ACCOUNT_GRACE_SECONDS,
"grace_extends_cloud_access": False,
"upgrade_url": licensing.upgrade_url(),
diff --git a/engraphis/routes/v2_api.py b/engraphis/routes/v2_api.py
index fc14c6cdb..6e79dad47 100644
--- a/engraphis/routes/v2_api.py
+++ b/engraphis/routes/v2_api.py
@@ -4325,6 +4325,10 @@ def _hosted_license_detail() -> dict:
"error": "Start or manage Pro and Team in the Engraphis Cloud account portal.",
"cloud_only": True,
"trial_seconds": licensing.TRIAL_SECONDS,
+ # The Pro duration is the legacy single-value boundary; Team is disclosed separately
+ # so a client that reads only this refusal still quotes the right Team length.
+ "trial_days": licensing.TRIAL_DAYS,
+ "days_by_plan": trial_days_by_plan(),
"grace_seconds": licensing.MAX_HOSTED_ACCOUNT_GRACE_SECONDS,
"grace_extends_cloud_access": False,
"upgrade_url": licensing.upgrade_url(),
diff --git a/scripts/init.py b/scripts/init.py
index 5e921798e..e2a6c4a1c 100644
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -28,6 +28,7 @@
from typing import Any, Callable, Optional
from engraphis.backends.encrypted_db import connector_from_env
+from engraphis.commercial import expected_checkout_targets, trial_days_by_plan
from engraphis.private_state import (
atomic_private_text,
ensure_owner_private_dir,
@@ -60,6 +61,53 @@ def _try_import(name: str):
return None
+def _trial_offer_label() -> str:
+ """Name each disclosed trial duration so onboarding never promises Team 7 days.
+
+ The manifest is the only authority for how long a trial lasts; a missing or damaged
+ manifest degrades to "free trial" rather than replaying the Pro default at a Team buyer.
+ """
+ days = trial_days_by_plan()
+ offers = [
+ f"{days[plan]}-day {plan.capitalize()} trial"
+ for plan in ("pro", "team")
+ if plan in days
+ ]
+ if not offers:
+ return "free trial"
+ if len(offers) == 1:
+ return offers[0]
+ return offers[0] + " or the " + offers[1]
+
+
+def _plan_checkout_links() -> list[tuple[str, str]]:
+ """Return one target per plan the trial offer names.
+
+ The offer names Pro and Team, so a single Pro checkout link sent a Team buyer into the
+ wrong product. Each named plan gets its own manifest target; when the manifest cannot
+ supply one, the plan-neutral account portal is used rather than another plan's checkout.
+ An unreadable manifest yields the neutral ``Account & billing`` target, because
+ onboarding must never end in a traceback.
+ """
+ # Imported here, not at module scope: ``engraphis.licensing`` validates the entitlement
+ # contract when imported, and this is the doctor/recovery command.
+ from engraphis.licensing import account_url
+
+ disclosed = trial_days_by_plan()
+ portal = account_url()
+ try:
+ targets = expected_checkout_targets()
+ except (OSError, ValueError, TypeError, AttributeError):
+ return [("Account & billing", portal)]
+ links = []
+ for plan in ("pro", "team"):
+ if plan not in disclosed:
+ continue
+ target = targets.get((plan, "monthly")) or {}
+ links.append((plan.capitalize(), target.get("checkout_url") or portal))
+ return links
+
+
def _report_receipt_chains(
conn: Any, report: Callable[[str, str, str, str], None]
) -> None:
@@ -676,8 +724,15 @@ def main(argv=None) -> int:
print(" In the dashboard: create a workspace, save one project decision, review its source and Approve for prompt.")
print(" Then Ask about the decision to see its cited source.")
print(" Open its citation to review the source; edit the record when the decision changes.")
- print(" Free forever at the core - start the 7-day Pro trial or subscribe at "
- "https://api.engraphis.com/account?plan=pro&interval=monthly#billing")
+ print(" Free forever at the core - start the "
+ f"{_trial_offer_label()}, or subscribe at:")
+ links = _plan_checkout_links()
+ if not links:
+ from engraphis.licensing import account_url
+
+ print(f" {account_url()}")
+ for plan, url in links:
+ print(f" {plan}: {url}")
return 0
diff --git a/scripts/render_benchmark_examples.py b/scripts/render_benchmark_examples.py
index 86c2a35bd..94bc33686 100644
--- a/scripts/render_benchmark_examples.py
+++ b/scripts/render_benchmark_examples.py
@@ -36,7 +36,7 @@ def main(argv=None) -> int:
parser.add_argument("--report", type=Path, required=True)
parser.add_argument("--output", type=Path, required=True)
parser.add_argument("--png-output", type=Path,
- help="optional PNG export path (requires CairoSVG)")
+ help="optional PNG export path (requires CairoSVG or Playwright)")
args = parser.parse_args(argv)
artifact_sha256 = render(args.report, args.output)
if args.png_output:
diff --git a/scripts/render_benchmark_report.py b/scripts/render_benchmark_report.py
index d2c69761f..79cdc7854 100644
--- a/scripts/render_benchmark_report.py
+++ b/scripts/render_benchmark_report.py
@@ -717,13 +717,32 @@ def render_report(report: dict[str, Any]) -> str:
def render_png(svg: str, output: Path, artifact_sha256: str,
*, width: Optional[int] = None, height: Optional[int] = None) -> None:
"""Rasterize this SVG and bind the export to its artifact and exact SVG bytes."""
- try:
- import cairosvg
- except ImportError as exc:
- raise SystemExit("--png-output requires CairoSVG; install it with `pip install cairosvg`") from exc
digest = _require_sha256(artifact_sha256, "PNG artifact SHA-256")
svg_bytes = svg.encode("utf-8")
- png = cairosvg.svg2png(bytestring=svg_bytes, output_width=width, output_height=height)
+ try:
+ import cairosvg
+ png = cairosvg.svg2png(bytestring=svg_bytes, output_width=width, output_height=height)
+ except (ImportError, OSError):
+ import base64
+ try:
+ from playwright.sync_api import sync_playwright
+ except ImportError as exc:
+ raise SystemExit(
+ "--png-output requires CairoSVG or Playwright (`pip install cairosvg` or `pip install playwright`)"
+ ) from exc
+ m_w = re.search(r'width="(\d+)"', svg)
+ m_h = re.search(r'height="(\d+)"', svg)
+ w = width or (int(m_w.group(1)) if m_w else 1103)
+ h = height or (int(m_h.group(1)) if m_h else 670)
+ with sync_playwright() as p:
+ browser = p.chromium.launch()
+ try:
+ page = browser.new_page(viewport={"width": w, "height": h}, device_scale_factor=1)
+ b64 = base64.b64encode(svg_bytes).decode("ascii")
+ page.goto(f"data:image/svg+xml;base64,{b64}")
+ png = page.screenshot(omit_background=True)
+ finally:
+ browser.close()
metadata = b""
for key, value in (
("engraphis_artifact_sha256", digest),
@@ -741,7 +760,7 @@ def main(argv: Optional[list[str]] = None) -> int:
parser = argparse.ArgumentParser(description="Render an artifact-backed benchmark report as SVG and optional PNG.")
parser.add_argument("--report", required=True, help="JSON artifact or selected performance report")
parser.add_argument("--output", required=True, help="destination SVG path")
- parser.add_argument("--png-output", help="optional PNG export path (requires CairoSVG)")
+ parser.add_argument("--png-output", help="optional PNG export path (requires CairoSVG or Playwright)")
args = parser.parse_args(argv)
report = load_report(args.report)
svg = render_report(report)
diff --git a/tests/test_benchmark_evidence.py b/tests/test_benchmark_evidence.py
index c70154cc5..0772c0bef 100644
--- a/tests/test_benchmark_evidence.py
+++ b/tests/test_benchmark_evidence.py
@@ -34,8 +34,8 @@
ROOT = Path(__file__).resolve().parents[1]
-PUBLIC_OFFLINE_ARTIFACT = "offline-fixtures-perf-vector-20261118.json"
-PUBLIC_OFFLINE_SHA = "91362de33eebd74bb6d28dd24025f57ad029c995d0bf68e44d5561c0b6c8e9bb"
+PUBLIC_OFFLINE_ARTIFACT = "offline-fixtures-ux-parity-20261120.json"
+PUBLIC_OFFLINE_SHA = "f671ed73fadd2f91728294490656675243547214aba57810571c36697b6bb583"
@pytest.fixture(scope="module")
diff --git a/tests/test_commercial_hardening.py b/tests/test_commercial_hardening.py
index aab53c4bf..b41e0ce6d 100644
--- a/tests/test_commercial_hardening.py
+++ b/tests/test_commercial_hardening.py
@@ -263,6 +263,74 @@ def test_the_checkout_catalog_reads_a_broken_manifest_without_raising(monkeypatc
assert ("team", "monthly") in targets
+def test_repeated_manifest_reads_do_not_reparse_and_never_serve_a_stale_file(
+ monkeypatch, tmp_path,
+) -> None:
+ """Every license read asks for the plan table; an unchanged file must not be re-parsed.
+
+ The cache identity is the file's own ``(path, mtime_ns, size)``, so a rewritten manifest
+ has to be re-read rather than answered from the cache.
+ """
+
+ from engraphis import commercial as module
+
+ path = tmp_path / "commercial_manifest.json"
+ path.write_text('{"version": "first"}', encoding="utf-8")
+ monkeypatch.setattr(module, "_manifest_path", lambda: path)
+ parsed = lambda: module._load_manifest.cache_info().misses # noqa: E731
+
+ module.reload()
+ assert module.manifest() == {"version": "first"}
+ path.write_text('{"version": "second", "padding": 1}', encoding="utf-8")
+ assert module.manifest() == {"version": "second", "padding": 1}
+ assert parsed() == 2, "a changed identity must be re-read once"
+
+ before = parsed()
+ for _ in range(5):
+ assert module.manifest()["version"] == "second"
+ assert module.expected_checkout_targets() == {}
+ assert parsed() == before, "an unchanged manifest must not be re-read"
+
+
+def test_two_manifests_with_the_same_timestamp_and_size_do_not_collide(tmp_path) -> None:
+ """The cache key must include the path, not only the file's ``(mtime_ns, size)``.
+
+ A packaging or sync step can leave two manifests with identical size and modification
+ time. Keying only on that identity answered the second path with the first path's plan
+ table, so a caller reading an unrelated manifest saw the wrong prices.
+ """
+
+ first = tmp_path / "first.json"
+ second = tmp_path / "second.json"
+ first.write_text('{"version": "first"}', encoding="utf-8")
+ second.write_text('{"version": "secon"}', encoding="utf-8")
+ assert first.stat().st_size == second.stat().st_size
+ timestamp = first.stat().st_mtime_ns
+ os.utime(second, ns=(timestamp, timestamp))
+ assert second.stat().st_mtime_ns == timestamp
+
+ assert commercial.manifest(first) == {"version": "first"}
+ assert commercial.manifest(second) == {"version": "secon"}
+ assert commercial.manifest(first) == {"version": "first"}
+
+
+def test_a_caller_cannot_corrupt_the_cached_manifest() -> None:
+ """``manifest()`` hands out a deep copy; the process cache stays authoritative."""
+
+ original = commercial.manifest()
+ expected_price = original["plans"]["pro"]["monthly_usd"]
+
+ returned = commercial.manifest()
+ returned["plans"]["pro"]["monthly_usd"] = 0
+ returned["features"]["sso"] = not original["features"]["sso"]
+ del returned["trial"]
+
+ fresh = commercial.manifest()
+ assert fresh["plans"]["pro"]["monthly_usd"] == expected_price
+ assert fresh["features"] == original["features"]
+ assert "trial" in fresh
+
+
def test_the_published_prices_match_the_manifest_where_pricing_is_documented() -> None:
"""The focused plan guide and upgrade panels restate manifest prices."""
diff --git a/tests/test_dashboard_auth_placement.py b/tests/test_dashboard_auth_placement.py
index eaf9b7e33..4abd446a9 100644
--- a/tests/test_dashboard_auth_placement.py
+++ b/tests/test_dashboard_auth_placement.py
@@ -642,6 +642,189 @@ def test_plans_list_every_hosted_benefit_and_use_the_state_specific_cta():
assert ".plan-benefit-list" in styles
+def test_team_plan_card_advertises_only_live_granted_capabilities():
+ """Team's card must match the live grant, the plan guide, and the commercial flags.
+
+ The card once read "Shared workspaces, member roles, seats and remote agents", while
+ ``docs/HOSTED_PLANS.md`` states that shared hosted Team memory and hosted MCP are
+ ``not_yet_available``. A card that sells an unshipped capability is worse than a missing
+ benefit row, so both the bullets and the note are resolved against the sources of truth.
+ """
+
+ from engraphis import commercial, entitlements
+
+ benefits = _ledger_declaration("PLAN_BENEFITS")
+ team_block = benefits[benefits.index("team: ["):]
+ bullets = [
+ line.strip().strip(",").strip("'")
+ for line in team_block.splitlines()
+ if line.strip().startswith("'")
+ ]
+ assert bullets
+ assert "Everything in Pro" in bullets
+
+ plans = _ledger_declaration("renderPlans")
+ team_card = plans[plans.index("id: 'team'"):]
+ note = team_card[team_card.index("note: '") + len("note: '"):]
+ note = note[:note.index("'")]
+ assert note, "the Team card still describes the plan"
+ card_copy = " ".join(bullets + [note]).lower()
+
+ hosted = " ".join((ROOT / "docs" / "HOSTED_PLANS.md").read_text(encoding="utf-8").split())
+ hosted_lower = hosted.lower()
+ assert "Shared hosted Team memory and hosted MCP are currently `not_yet_available`" in hosted
+
+ # Each Team capability noun on the card is backed by a manifest-enabled feature that the
+ # plan guide actually documents. A noun with no row in either source is an unshipped claim.
+ features = commercial.manifest()["features"]
+ capability_rows = {
+ "organizations": ("hosted_multi_user_roles", "team account roster"),
+ "roles": ("hosted_multi_user_roles", "roles"),
+ "seats": ("hosted_multi_user_roles", "named seats"),
+ "invitations": ("hosted_multi_user_roles", "invitations"),
+ "credentials": ("hosted_scoped_agent_tokens", "sync tokens"),
+ "audit": ("hosted_team_audit_export", "activity"),
+ }
+ for phrase in ("hosted organizations", "roles", "seats", "credentials", "audit"):
+ assert phrase in card_copy, phrase
+ for phrase, (feature, documented) in capability_rows.items():
+ assert features.get(feature) is True, (phrase, feature)
+ assert entitlements.feature_spec(feature)["plan"] == "team", phrase
+ assert documented in hosted_lower, (phrase, documented)
+
+ granted = set(entitlements.features_for("team"))
+ assert {"team", "sync"} <= granted
+
+ # Also verify the static Team panel heading and plans comparison table in index.html.
+ html = INDEX.read_text(encoding="utf-8")
+ team_panel = _section(html, '
")
+ comparison = _section(html, '")
+ combined_team_ui = " ".join([card_copy, team_panel.lower(), comparison.lower()])
+
+ # Nothing the plan guide marks unavailable, and nothing the manifest leaves unshipped,
+ # may appear on the card, the Team panel heading, or the comparison table.
+ for absent in (
+ "shared workspace", "shared hosted team memory", "hosted mcp",
+ "remote agents", "remote agent access", "compliance_export", "compliance",
+ ):
+ assert absent not in combined_team_ui, absent
+ for token in ("sso", "sla"):
+ assert re.search(rf"\b{token}\b", combined_team_ui) is None, token
+
+
+@requires_node
+def test_creating_a_sync_key_never_writes_the_secret_to_the_clipboard_unprompted(tmp_path):
+ """Guard that rendering a one-time E2EE key never writes to the clipboard unprompted.
+
+ Only the explicit ``Copy key`` click handler may invoke ``copyCloudSyncKey`` or
+ ``navigator.clipboard.writeText``, and any clipboard rejection must surface a notice.
+ """
+
+ declarations = ("node", "button", "copyCloudSyncKey", "renderCreatedSyncKey")
+ prelude = """
+'use strict';
+class FakeElement {
+ constructor(tag) {
+ this.tagName = String(tag).toUpperCase();
+ this.children = [];
+ this.className = '';
+ this.ownText = '';
+ this.listeners = {};
+ }
+ set textContent(value) { this.ownText = String(value); this.children = []; }
+ get textContent() { return this.ownText + this.children.map(child => child.textContent).join(''); }
+ append(...items) { items.filter(item => item != null).forEach(item => this.children.push(item)); }
+ replaceChildren(...items) { this.ownText = ''; this.children = []; this.append(...items); }
+ setAttribute() {}
+ addEventListener(type, handler) {
+ /* ``addEventListener(type, undefined)`` registers nothing in a browser. */
+ if (handler) (this.listeners[type] = this.listeners[type] || []).push(handler);
+ }
+ click() { (this.listeners.click || []).forEach(handler => handler({ preventDefault() {} })); }
+}
+const document = {
+ createElement: tag => new FakeElement(tag),
+ createTextNode: value => ({ textContent: String(value), children: [] }),
+ getElementById: () => null,
+};
+const text = value => value == null ? '' : String(value);
+const writes = [];
+const notices = [];
+const clipboard = { reject: false };
+const showNotice = message => notices.push(String(message));
+const renderSyncStatus = () => {};
+Object.defineProperty(globalThis, 'navigator', {
+ value: { clipboard: { writeText: async value => {
+ if (clipboard.reject) throw new Error('NotAllowedError');
+ writes.push(value);
+ } } },
+ configurable: true,
+});
+const settle = async () => { for (let i = 0; i < 5; i += 1) await new Promise(resolve => setTimeout(resolve, 0)); };
+"""
+ driver = """
+(async () => {
+ const report = {};
+ const target = document.createElement('div');
+ renderCreatedSyncKey(target, 'A'.repeat(43), {has_key: true});
+ const buttons = target.children.flatMap(child => child.children || [])
+ .filter(item => item.tagName === 'BUTTON');
+ await settle();
+ report.renderedWrites = writes.slice();
+ report.renderedNotices = notices.slice();
+ report.text = target.textContent;
+
+ buttons.find(item => item.textContent === 'Copy key').click();
+ await settle();
+ report.copiedWrites = writes.slice();
+ report.copiedNotices = notices.slice();
+
+ clipboard.reject = true;
+ buttons.find(item => item.textContent === 'Copy key').click();
+ await settle();
+ report.failedWrites = writes.slice();
+ report.failedNotices = notices.slice();
+ report.buttons = buttons.map(item => item.textContent);
+ process.stdout.write(JSON.stringify(report));
+})();
+"""
+ runner = tmp_path / "sync_key.js"
+ runner.write_text("\n".join([
+ prelude,
+ *(_ledger_declaration(name) for name in declarations),
+ driver,
+ ]), encoding="utf-8")
+ result = subprocess.run(["node", str(runner)], capture_output=True, text=True, timeout=30)
+ assert result.returncode == 0, result.stderr
+ rendered = json.loads(result.stdout)
+
+ # (a) Rendering the one-time key performs zero automatic clipboard writes.
+ assert rendered["renderedWrites"] == []
+ assert rendered["renderedNotices"] == []
+ assert "Cloud Sync key created" in rendered["text"]
+ assert ("It is shown only once, click Copy key to copy it to your clipboard"
+ in rendered["text"])
+ assert rendered["buttons"] == ["Copy key", "I stored the key"]
+
+ # (b) The explicit Copy key action copies once and confirms it.
+ assert rendered["copiedWrites"] == ["A" * 43]
+ assert rendered["copiedNotices"] == ["Cloud Sync key copied."]
+
+ # (c) A withheld clipboard permission is reported, never silently swallowed.
+ assert rendered["failedWrites"] == ["A" * 43]
+ assert rendered["failedNotices"][-1] == (
+ "Copy failed. Select the key and copy it manually.")
+
+ # (d) Every clipboard reference sits inside the explicit click handler. This stays true
+ # even if the handler is renamed, so a future auto-copy on render is still caught.
+ body = _ledger_declaration("renderCreatedSyncKey")
+ handler_start = body.index("copyBtn.addEventListener")
+ handler_stop = body.index("});", handler_start) + len("});")
+ outside_handler = body[:handler_start] + body[handler_stop:]
+ for forbidden in ("navigator.clipboard", "copyCloudSyncKey", "writeText"):
+ assert forbidden not in outside_handler, forbidden
+
+
def test_team_invitations_and_password_setup_are_not_in_local_client():
html = INDEX.read_text(encoding="utf-8")
script = SCRIPT.read_text(encoding="utf-8")
diff --git a/tests/test_hosted_plan_resolution.py b/tests/test_hosted_plan_resolution.py
index 6c9616dda..0cd87aa5f 100644
--- a/tests/test_hosted_plan_resolution.py
+++ b/tests/test_hosted_plan_resolution.py
@@ -1984,6 +1984,43 @@ def test_unknown_team_trial_duration_is_never_inferred_from_legacy_days(monkeypa
assert payload["trial"]["trial_days"] == 7
+def test_the_cloud_only_refusal_discloses_each_plans_own_trial_duration() -> None:
+ """A client that only sees the 501 still must not quote a 7-day Team trial."""
+
+ detail = v2_api._hosted_license_detail()
+
+ assert detail["days_by_plan"] == {"pro": 7, "team": 14}
+ assert detail["trial_days"] == 7
+ assert detail["trial_seconds"] == 7 * 24 * 60 * 60
+
+
+def test_legacy_license_surface_discloses_the_per_plan_trial_days() -> None:
+ """``/memory/license`` published only the Pro duration as if it were every plan's."""
+
+ import asyncio
+
+ from engraphis.routes import memory as memory_routes
+
+ payload = asyncio.run(memory_routes.get_license())["data"]
+
+ assert payload["days_by_plan"] == {"pro": 7, "team": 14}
+ assert payload["trial_days"] == 7
+ assert payload["trial_seconds"] == 7 * 24 * 60 * 60
+
+
+@pytest.mark.parametrize("plan", ["pro", "team"])
+def test_hosted_license_discloses_manifest_duration_per_plan(monkeypatch, plan) -> None:
+ from engraphis import commercial
+
+ monkeypatch.setattr(commercial, "manifest", lambda: {
+ "trial": {"days_by_plan": {"pro": 3, "team": 21}},
+ })
+ assert v2_api.get_license()["trial"]["days_by_plan"][plan] == (
+ 3 if plan == "pro" else 21)
+ assert v2_api._hosted_license_detail()["days_by_plan"][plan] == (
+ 3 if plan == "pro" else 21)
+
+
def test_a_connected_but_unanswered_installation_offers_no_trial(monkeypatch) -> None:
"""First boot after onboarding: the plan is inferred, the trial must not be.
diff --git a/tests/test_init.py b/tests/test_init.py
index 544fc1981..bd5b4a985 100644
--- a/tests/test_init.py
+++ b/tests/test_init.py
@@ -136,6 +136,112 @@ def test_existing_env_snippets_use_the_kept_database(tmp_path, monkeypatch, caps
assert str(kept) in capsys.readouterr().out
+def test_onboarding_trial_copy_discloses_each_plans_own_duration(tmp_path, monkeypatch, capsys):
+ """One hardcoded "7-day Pro trial" line used to speak for Team as well."""
+
+ monkeypatch.chdir(tmp_path)
+ assert main([]) == 0
+ out = capsys.readouterr().out
+ assert "7-day Pro trial or the 14-day Team trial" in out
+ assert "7-day Pro trial or subscribe" not in out
+
+
+def test_every_plan_named_in_the_trial_offer_has_its_own_checkout(tmp_path, monkeypatch, capsys):
+ """A Team reader must never be handed only the Pro checkout.
+
+ Every plan the offer names is read from the manifest, and each one is printed with the
+ target the manifest publishes for it. Nothing here is a hardcoded URL: a repriced or
+ re-routed portal changes the assertion's expected value with it.
+ """
+
+ from engraphis import commercial, licensing
+
+ monkeypatch.chdir(tmp_path)
+ assert main([]) == 0
+ out = capsys.readouterr().out
+ targets = commercial.expected_checkout_targets()
+ disclosed = commercial.trial_days_by_plan()
+ offer = init_script._trial_offer_label()
+
+ assert disclosed, "the manifest must disclose at least one trial duration"
+ printed = {}
+ for plan in disclosed:
+ assert plan.capitalize() + " trial" in offer, plan
+ expected = (targets.get((plan, "monthly")) or {}).get("checkout_url")
+ assert expected, (plan, targets)
+ assert f" {plan.capitalize()}: {expected}" in out, plan
+ printed[plan] = expected
+
+ # Each named plan reaches its own product page; no plan inherits another's checkout.
+ assert len(set(printed.values())) == len(printed)
+ assert licensing.account_url() not in printed.values(), (
+ "a manifest-routed plan must print its own checkout, not the neutral portal"
+ )
+
+
+def test_a_damaged_manifest_still_never_points_a_team_reader_at_pro_checkout(
+ monkeypatch,
+):
+ """With no checkout catalog the printed target must be plan-neutral, not the Pro page."""
+
+ from engraphis import commercial, licensing
+
+ monkeypatch.setattr(init_script, "expected_checkout_targets", lambda: {})
+ portal = licensing.account_url()
+ assert portal != (commercial.manifest()["plans"]["pro"]["products"]["monthly"]
+ ["checkout_url"])
+
+ links = init_script._plan_checkout_links()
+ assert links, "the offer still names plans"
+ assert {url for _, url in links} == {portal}
+
+
+def test_an_unreadable_manifest_falls_back_to_the_account_portal(
+ monkeypatch, tmp_path, capsys,
+):
+ """The raising branch is the one that protects a Team buyer from a broken manifest.
+
+ ``expected_checkout_targets()`` re-reads the manifest, so a raised ``OSError`` is the
+ realistic failure. Onboarding must print the plan-neutral account target instead of a
+ traceback or another plan's checkout.
+ """
+
+ from engraphis import licensing
+
+ fallback_url = licensing.account_url()
+
+ def unreadable():
+ raise OSError("manifest unreadable")
+
+ monkeypatch.setattr(init_script, "expected_checkout_targets", unreadable)
+
+ links = init_script._plan_checkout_links()
+ assert links == [("Account & billing", fallback_url)]
+ assert tuple(f"{plan}: {url}" for plan, url in links) == (
+ f"Account & billing: {fallback_url}",
+ )
+
+ monkeypatch.chdir(tmp_path)
+ assert main(["--no-encryption"]) == 0
+ out = capsys.readouterr().out
+ assert f" Account & billing: {fallback_url}" in out
+ assert "Traceback" not in out
+
+
+def test_onboarding_trial_copy_tracks_the_manifest(monkeypatch):
+ """A changed manifest changes the offer; the CLI never keeps its own duration."""
+
+ monkeypatch.setattr(
+ init_script, "trial_days_by_plan", lambda: {"pro": 5, "team": 17})
+ assert init_script._trial_offer_label() == "5-day Pro trial or the 17-day Team trial"
+
+ # A damaged manifest must not let the Pro default masquerade as a Team duration.
+ monkeypatch.setattr(init_script, "trial_days_by_plan", lambda: {})
+ assert init_script._trial_offer_label() == "free trial"
+ monkeypatch.setattr(init_script, "trial_days_by_plan", lambda: {"pro": 7})
+ assert init_script._trial_offer_label() == "7-day Pro trial"
+
+
@pytest.mark.skipif(os.name == "nt", reason="POSIX permission bits do not apply on Windows")
def test_generated_trusted_env_and_parent_are_private(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)