Spaces:
Running
Running
github-actions[bot] commited on
Commit Β·
5b1642d
1
Parent(s): dc4be02
Deploy 6177917
Browse filesMerge pull request #361 from WINTER4000/claude/shared-projects
Source: https://github.com/WINTER4000/turingDNA/commit/6177917dba6df00c4bcbc3e919d360ad2e447c9e
Files changed (10)
- dee/auth.py+126-4
- dee/core/project_workspaces.py+107-43
- dee/server.py+53
- dee/static/app.js+89-10
- dee/static/collab.css+92
- dee/static/collab.js+11
- dee/static/history.jsAdded+295
- dee/static/index.html+44-39
- dee/static/project.js+48-3
- tests/test_shared_projects.pyAdded+441
5027 unmodified lines50285029503050315032503321 unmodified lines50555056505750585059506050618 unmodified lines507050715072507350745075507630 unmodified lines5107510851095110511151125113511451155116511798 unmodified lines5216521752185219522052215222522352245225522652275228522952305027 unmodified linesreturn {"ok": False, "error": "Couldn't delete."}def attach_artifact(user_id: Optional[str], construct_id: str,kind: str, artifact_id: str) -> Dict[str, Any]:"""Record that an artifact belongs to a construct, and advance the phase.21 unmodified linesdef _attach_artifact_locked(user_id, construct_id, col, kind, artifact_id):row = get_construct(user_id, construct_id)if not row:return {"ok": False, "error": "No such project."}current = row.get(col) or []if artifact_id in current:return {"ok": True, "already": True}8 unmodified linesif (row.get("phase") in _CONSTRUCT_PHASES) else 0if _CONSTRUCT_PHASES.index(want) > cur_i:fields["phase"] = wantreturn update_construct(user_id, construct_id, **fields)def _dashed_uuid(value: str) -> Optional[str]:30 unmodified lineswith _construct_lock(construct_id):row = get_construct(user_id, construct_id)if not row:return {"ok": False, "error": "No such project."}meta = dict(row.get("meta") or {})history = [x for x in (meta.get("library_ids") or []) if x and x != lib]meta["library_ids"] = ([lib] + history)[:_LIBRARY_HISTORY]res = update_construct(user_id, construct_id, library_id=lib, meta=meta)try:record_edge(user_id, from_kind="sequence", from_id=construct_id,to_kind="library", to_id=lib, relation="derived_from",98 unmodified linesif not row:return {"ok": False, "error": "No such project."}meta = dict(row.get("meta") or {})merged = dict(clean_workspace(meta.get("workspace")))merged.update(clean)meta["workspace"] = mergedres = update_construct(user_id, construct_id, _touch=False, meta=meta)if not res.get("ok"):return resreturn {"ok": True, "workspace": merged}def _set_identity(user_id: str, construct_id: str, ident: Dict[str, str]) -> None:"""Record the protein on a project that was created before identitieswere kept. Same lock as every other writer of constructs.meta."""5027 unmodified lines502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511521 unmodified lines51375138513951405141514251435144514551468 unmodified lines5155515651575158515951605161516251635164516530 unmodified lines5196519751985199520052015202520352045205520652075208520952105211521298 unmodified lines5311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525027 unmodified linesreturn {"ok": False, "error": "Couldn't delete."}def _service_rpc(fn: str, params: Dict[str, Any], timeout: float = 6.0) -> Dict[str, Any]:"""One engine-only database function, called with the service key.Only for the two functions 0068 grants to service_role and nobody else.The actor they act for is always the engine's verified session user,passed by the caller β never a value from a request body."""import urllib.requestimport urllib.errorif not (SUPABASE_URL and SUPABASE_SERVICE_KEY):return {"ok": False, "error": "Not configured."}try:req = urllib.request.Request(f"{SUPABASE_URL}/rest/v1/rpc/{fn}",data=json.dumps(params).encode("utf-8"), method="POST",headers=_supabase_headers({"Content-Type": "application/json"}))with urllib.request.urlopen(req, timeout=timeout) as resp:out = json.loads(resp.read().decode("utf-8") or "null")return out if isinstance(out, dict) else {"ok": False, "error": "Bad response."}except urllib.error.HTTPError as exc:# 403 is the function refusing (not a member, not an editor, not# their result); 404 is 0068 not applied yet. Neither is an error# worth more than a line: the save the user asked for has succeeded.logger.info("%s refused (%s)", fn, exc.code)return {"ok": False, "error": "Refused.", "status": exc.code}except Exception as exc: # noqa: BLE001logger.warning("%s failed: %s", fn, exc)return {"ok": False, "error": "Unavailable."}# What 0068's project_file_work accepts: the three attach_artifact files,# plus a library, which attach_library files._FILEABLE_KINDS = ("library", "plasmid", "crispr", "primer")def file_project_work(actor_id: Optional[str], construct_id: str,kind: str, artifact_id: str) -> Dict[str, Any]:"""Work done on a project's bench, filed into that project, with who did it.For an EDITOR of somebody else's project this is the link itself: theirsave lands in their own account (every artifact table is owner-scoped)and 0068's project_file_work adds it to the project β the same rule the`contribute` action enforces, checked in the database, not here. Beforethis, filing it took a dialog, a dropdown and a consent tick per result,which is how a shared project came to "arrive with nothing in it".For the OWNER it only records the change: their own path has linked it.A viewer, a former member, an expired project and somebody else's resultare all refused by the function. Never raises."""if kind not in _FILEABLE_KINDS or not actor_id \or not _valid_uuid(construct_id) or not _valid_uuid(str(artifact_id or "")):return {"ok": False, "error": "Bad request."}return _service_rpc("project_file_work", {"actor": str(actor_id), "project": construct_id,"kind": kind, "artifact": str(artifact_id)})def _log_project_work_async(actor_id: str, construct_id: str, kind: str,artifact_id: str) -> None:"""The owner's half: a history line, off the request that saved the work.A log entry is worth a background write, never a slower save."""if not (SUPABASE_URL and SUPABASE_SERVICE_KEY):returnthreading.Thread(target=file_project_work,args=(actor_id, construct_id, kind, artifact_id),name=f"dee-history-{construct_id[:8]}", daemon=True).start()def note_project_bench(actor_id: Optional[str], construct_id: str,structure: Optional[str] = None,complex_id: Optional[str] = None) -> Dict[str, Any]:"""Record that the owner put a different structure or complex on theproject's bench β the bench a collaborator opens. Owner only, publichandles only, a repeat is skipped (all enforced by project_note_bench).Never raises."""if not actor_id or not _valid_uuid(construct_id) or not (structure or complex_id):return {"ok": False, "error": "Bad request."}return _service_rpc("project_note_bench", {"actor": str(actor_id), "project": construct_id,"structure": structure or None, "complex": complex_id or None})def attach_artifact(user_id: Optional[str], construct_id: str,kind: str, artifact_id: str) -> Dict[str, Any]:"""Record that an artifact belongs to a construct, and advance the phase.21 unmodified linesdef _attach_artifact_locked(user_id, construct_id, col, kind, artifact_id):row = get_construct(user_id, construct_id)if not row:# Not the caller's own project. It may be one they EDIT: then the# result is filed into it, and the history says they did it.res = file_project_work(user_id, construct_id, kind, artifact_id)return res if res.get("ok") else {"ok": False, "error": "No such project."}current = row.get(col) or []if artifact_id in current:return {"ok": True, "already": True}8 unmodified linesif (row.get("phase") in _CONSTRUCT_PHASES) else 0if _CONSTRUCT_PHASES.index(want) > cur_i:fields["phase"] = wantres = update_construct(user_id, construct_id, **fields)if res.get("ok"):# Who added it, for whoever this project is shared with now or later._log_project_work_async(user_id, construct_id, kind, artifact_id)return resdef _dashed_uuid(value: str) -> Optional[str]:30 unmodified lineswith _construct_lock(construct_id):row = get_construct(user_id, construct_id)if not row:# A project the caller edits rather than owns (see# _attach_artifact_locked): filed through 0068, or refused.res = file_project_work(user_id, construct_id, "library", lib)return res if res.get("ok") else {"ok": False, "error": "No such project."}meta = dict(row.get("meta") or {})history = [x for x in (meta.get("library_ids") or []) if x and x != lib]new_library = row.get("library_id") != libmeta["library_ids"] = ([lib] + history)[:_LIBRARY_HISTORY]res = update_construct(user_id, construct_id, library_id=lib, meta=meta)if res.get("ok") and new_library:_log_project_work_async(user_id, construct_id, "library", lib)try:record_edge(user_id, from_kind="sequence", from_id=construct_id,to_kind="library", to_id=lib, relation="derived_from",98 unmodified linesif not row:return {"ok": False, "error": "No such project."}meta = dict(row.get("meta") or {})before = dict(clean_workspace(meta.get("workspace")))merged = dict(before)merged.update(clean)meta["workspace"] = mergedres = update_construct(user_id, construct_id, _touch=False, meta=meta)if not res.get("ok"):return res_note_bench_change_async(user_id, construct_id, before, merged)return {"ok": True, "workspace": merged}def _bench_handles(ws: Dict[str, Any]):st = (ws.get("structure") or {}).get("acc") or Nonecx = ((ws.get("interaction") or {}).get("pdb") or {}).get("pdb_id") or Nonereturn st, cxdef _note_bench_change_async(user_id: str, construct_id: str,before: Dict[str, Any], after: Dict[str, Any]) -> None:"""A history line when the project's bench shows a different protein orcomplex. Only on a CHANGE of handle β this is written every time thestructure tab draws, and a reload is not an edit. A structure guessedfrom the gene name (src "gene") is not something anybody chose, so it isnot logged as if they had."""st0, cx0 = _bench_handles(before)st1, cx1 = _bench_handles(after)if (after.get("structure") or {}).get("src") == "gene":st1 = st0if (st1, cx1) == (st0, cx0) or not (SUPABASE_URL and SUPABASE_SERVICE_KEY):returnthreading.Thread(target=note_project_bench,args=(user_id, construct_id,st1 if st1 != st0 else None, cx1 if cx1 != cx0 else None),name=f"dee-bench-{construct_id[:8]}", daemon=True).start()def _set_identity(user_id: str, construct_id: str, ident: Dict[str, str]) -> None:"""Record the protein on a project that was created before identitieswere kept. Same lock as every other writer of constructs.meta."""
110 unmodified lines11111211311411511656 unmodified lines173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221110 unmodified linesreturn rowsdef register(app, auth_module):def respond(data, status=200):response = jsonify(data)56 unmodified linesif result.get('conflict'):return respond({'error': 'Someone updated this project. Your draft is preserved. Reload before saving.', **result}, 409)if action == 'artifact':# IDs and owner come ONLY from the authorization RPC, never the client.loaders = {'library': auth_module.load_library, 'plasmid': auth_module.get_plasmid,'crispr': auth_module.get_crispr_design, 'primer': auth_module.get_primer_analysis}loader = loaders.get(result.get('kind'))if not loader or not result.get('owner_id') or not result.get('artifact_id'):raise WorkspaceError('Result unavailable.', 404)artifact = loader(result['owner_id'], result['artifact_id'])if not artifact:raise WorkspaceError('Result no longer available.', 404)# Recheck after a potentially slow storage fetch; a revoked membership# must not receive a result fetched while access was changing.rpc(auth_module, auth, action, project_id, body)# Explicit shapes for existing raw-row loaders. No storage paths,# arbitrary metadata or ownership credentials leave the server.fields = {'plasmid': ('id', 'name', 'sequence', 'features', 'topology', 'created_at'),'crispr': ('id', 'label', 'gene_symbol', 'organism', 'mode', 'enzyme', 'base_editor', 'guides', 'input_length', 'created_at'),'primer': ('id', 'label', 'result', 'organism', 'template_len', 'n_primers', 'created_at'),'library': ('id', 'name', 'library_id', 'wt_protein', 'wt_identifier', 'variants', 'host_organism', 'n_variants'),}[result['kind']]shaped = {k: artifact[k] for k in fields if k in artifact}if result['kind'] == 'plasmid':# The primers, digests and alignments ON this construct.## They live in `plasmids.meta.objects` (construct_objects),# and `meta` is not in the allowlist above β deliberately,# when meta held only private bookkeeping. construct_objects# later put the scientist's own lab-notebook work in there,# and nobody revisited this line: a construct shared into a# project arrived as a bare sequence, with every primer,# digest and alignment on it silently gone. The author# sees them, the collaborator did not, and nothing said so.## `meta` still does not leave the server. plasmid_objects# runs the same strict field allowlist the owner's own# route uses (construct_objects.sanitize: declared fields# only, bounded strings, no storage paths and no ids), and# freshens each object against the sequence in the SAME# row β so a digest computed before an edit crosses the# account boundary labelled stale rather than as a claim# about these bases.shaped['objects'] = auth_module.plasmid_objects(artifact)result = {'artifact': shaped, 'kind': result['kind']}return respond({'ok': True, **result})except WorkspaceError as exc:return respond({'error': str(exc)}, exc.status)110 unmodified lines11111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022156 unmodified lines278279280281282283284285110 unmodified linesreturn rows# Explicit shapes for the owner-scoped raw-row loaders. No storage paths,# arbitrary metadata or ownership credentials leave the server._ARTIFACT_FIELDS = {'plasmid': ('id', 'name', 'sequence', 'features', 'topology', 'created_at'),'crispr': ('id', 'label', 'gene_symbol', 'organism', 'mode', 'enzyme', 'base_editor', 'guides', 'input_length', 'created_at'),'primer': ('id', 'label', 'result', 'organism', 'template_len', 'n_primers', 'created_at'),'library': ('id', 'name', 'library_id', 'wt_protein', 'wt_identifier', 'variants', 'host_organism', 'n_variants','top_fitness', 'created_at'),}def shared_artifact(auth_module, auth, project_id, payload, first=None):"""One result linked into a project, for a member, in its allowlisted shape.The order is the whole security property and has not changed since 0056:the RPC authorizes with the CALLER's JWT and names the owner and the id;the owner-scoped loader runs with exactly those; the RPC is asked AGAINafter the (possibly slow) storage fetch, so a membership revoked meanwhilenever receives what was fetched while it was live.`first` is an authorization the caller already holds (the /api/workspacesroute makes it as part of dispatch). Returns (kind, shaped)."""result = first if first is not None else rpc(auth_module, auth, 'artifact', project_id, payload)loaders = {'library': auth_module.load_library, 'plasmid': auth_module.get_plasmid,'crispr': auth_module.get_crispr_design, 'primer': auth_module.get_primer_analysis}# IDs and owner come ONLY from the authorization RPC, never the client.loader = loaders.get(result.get('kind'))if not loader or not result.get('owner_id') or not result.get('artifact_id'):raise WorkspaceError('Result unavailable.', 404)artifact = loader(result['owner_id'], result['artifact_id'])if not artifact:raise WorkspaceError('Result no longer available.', 404)# Recheck after a potentially slow storage fetch; a revoked membership# must not receive a result fetched while access was changing.rpc(auth_module, auth, 'artifact', project_id, payload)fields = _ARTIFACT_FIELDS[result['kind']]shaped = {k: artifact[k] for k in fields if k in artifact}if result['kind'] == 'plasmid':# The primers, digests and alignments ON this construct.## They live in `plasmids.meta.objects` (construct_objects), and `meta`# is not in the allowlist above β deliberately, when meta held only# private bookkeeping. construct_objects later put the scientist's own# lab-notebook work in there, and nobody revisited this line: a# construct shared into a project arrived as a bare sequence, with# every primer, digest and alignment on it silently gone.## `meta` still does not leave the server. plasmid_objects runs the same# strict field allowlist the owner's own route uses# (construct_objects.sanitize: declared fields only, bounded strings,# no storage paths and no ids), and freshens each object against the# sequence in the SAME row β so a digest computed before an edit# crosses the account boundary labelled stale rather than as a claim# about these bases.shaped['objects'] = auth_module.plasmid_objects(artifact)return result['kind'], shapeddef shared_construct(auth_module, auth, project_id):"""A project somebody shared with the caller, in the shape the engine'sown GET /api/constructs/<id> returns β so the bench opens it the way itopens the caller's own.Everything comes from the membership RPC (0068 `get`). `workspace` is theproject's BENCH β structure, complex, library β re-validated by the sameclean_workspace the owner's writes go through, and stripped of `run`even if a future serializer let one through: the owner's conversation isnot shared (docs/COLLABORATION-AUDIT.md, F4).`members` lists only the results `get` itself listed, i.e. the ones its'artifact' rule will authorize, so a tab never tries to open an id itwill be refused."""data = rpc(auth_module, auth, 'get', project_id)p = data.get('project') or {}if not p.get('id'):raise WorkspaceError('Project unavailable.', 404)bench = auth_module.clean_workspace(p.get('bench'))bench.pop('run', None)members = {}for r in data.get('results') or []:kind, rid = r.get('kind'), r.get('id')if kind in _ARTIFACT_FIELDS and rid:members.setdefault(kind, []).append(str(rid))ident = auth_module.clean_identity(p.get('identity'))return {'id': p['id'], 'name': p.get('name'), 'phase': p.get('phase') or 'Design','wt_identifier': p.get('wt_identifier'),'created_at': p.get('created_at'), 'updated_at': p.get('updated_at'),'library_id': p.get('library_id'),'n_plasmids': len(members.get('plasmid', [])),'n_crispr': len(members.get('crispr', [])),'n_primers': len(members.get('primer', [])),'sequence_dna': p.get('sequence_dna') or '','wt_protein': p.get('wt_protein') or '','workspace': bench,'members': members,'identity': ident,'shared': {'role': p.get('role'),'owner_name': p.get('owner_name'),'revision': p.get('revision'),},}def register(app, auth_module):def respond(data, status=200):response = jsonify(data)56 unmodified linesif result.get('conflict'):return respond({'error': 'Someone updated this project. Your draft is preserved. Reload before saving.', **result}, 409)if action == 'artifact':kind, shaped = shared_artifact(auth_module, auth, project_id, body, first=result)result = {'artifact': shaped, 'kind': kind}return respond({'ok': True, **result})except WorkspaceError as exc:return respond({'error': str(exc)}, exc.status)
3369 unmodified lines337033713372337333743375484 unmodified lines38603861386238633864386549 unmodified lines391539163917391839193920131 unmodified lines4052405340544055405640571190 unmodified lines52485249525052515252525367 unmodified lines5321532253235324532553263369 unmodified linesreturn deniedp = _auth.get_plasmid(auth.user_id, plasmid_id)if p is None:return jsonify({"ok": False, "error": "Plasmid not found."}), 404# Objects come back beside the plasmid rather than buried in `meta`,# already marked fresh or stale against the sequence in the same row β484 unmodified lines"kind": "signin_required"}), 403design = _auth.get_crispr_design(auth.user_id, design_id)if design is None:return jsonify({"ok": False, "error": "Design not found."}), 404return jsonify({"ok": True, "design": design})49 unmodified lines"kind": "signin_required"}), 403analysis = _auth.get_primer_analysis(auth.user_id, analysis_id)if analysis is None:return jsonify({"ok": False, "error": "Primer set not found."}), 404return jsonify({"ok": True, "analysis": analysis})131 unmodified lines"kind": "signin_required"}), 403lib = _auth.load_library(auth.user_id, library_id)if not lib:return jsonify({"ok": False, "error": "Library not found."}), 404return jsonify({"ok": True, "reopened": True, **lib})1190 unmodified lines# selection purely in local storage. Public tool access was a deliberate# decision and must not regress: nothing here may become a precondition# for running a tool.def _construct_out(row):"""Trim a row for the client. The full DNA/protein is only sent by thesingle-construct GET β the switcher must not ship megabytes."""67 unmodified linesreturn jsonify({"error": "Sign in.", "kind": "signin_required"}), 401row = _auth.get_construct(auth.user_id, construct_id)if not row:return jsonify({"error": "Not found."}), 404out = _construct_out(row)# Only here, and only for the one the user actually selected.3369 unmodified lines33703371337233733374337533763377337833793380484 unmodified lines38653866386738683869387038713872387349 unmodified lines392339243925392639273928392939303931131 unmodified lines40634064406540664067406840694070407140721190 unmodified lines526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529967 unmodified lines53675368536953705371537253735374537553765377537853793369 unmodified linesreturn deniedp = _auth.get_plasmid(auth.user_id, plasmid_id)if p is None:shared = _shared_artifact(auth, "plasmid", plasmid_id)if shared:objects = shared.pop("objects", None) or {}return jsonify({"ok": True, "plasmid": shared, "objects": objects,"shared": True})return jsonify({"ok": False, "error": "Plasmid not found."}), 404# Objects come back beside the plasmid rather than buried in `meta`,# already marked fresh or stale against the sequence in the same row β484 unmodified lines"kind": "signin_required"}), 403design = _auth.get_crispr_design(auth.user_id, design_id)if design is None:shared = _shared_artifact(auth, "crispr", design_id)if shared:return jsonify({"ok": True, "design": shared, "shared": True})return jsonify({"ok": False, "error": "Design not found."}), 404return jsonify({"ok": True, "design": design})49 unmodified lines"kind": "signin_required"}), 403analysis = _auth.get_primer_analysis(auth.user_id, analysis_id)if analysis is None:shared = _shared_artifact(auth, "primer", analysis_id)if shared:return jsonify({"ok": True, "analysis": shared, "shared": True})return jsonify({"ok": False, "error": "Primer set not found."}), 404return jsonify({"ok": True, "analysis": analysis})131 unmodified lines"kind": "signin_required"}), 403lib = _auth.load_library(auth.user_id, library_id)if not lib:shared = _shared_artifact(auth, "library", library_id)if shared:shared.pop("id", None)return jsonify({"ok": True, "reopened": True, "shared": True, **shared})return jsonify({"ok": False, "error": "Library not found."}), 404return jsonify({"ok": True, "reopened": True, **lib})1190 unmodified lines# selection purely in local storage. Public tool access was a deliberate# decision and must not regress: nothing here may become a precondition# for running a tool.# ββ Shared projects (0068) βββββββββββββββββββββββββββββββββββββββββββ# A project somebody shared with the caller opens through the same routes# their own work does. The owner's path always runs FIRST and is# unchanged; these only answer when it found nothing, and only through# project_workspace() with the caller's own JWT β there is no service-role# read of somebody else's project here, and a failed membership check# reads as "not found", never as an error that says the project exists.def _shared_construct(auth, construct_id):if not getattr(auth, "token", None):return Nonefrom .core import project_workspaces as _pwtry:return _pw.shared_construct(_auth, auth, construct_id)except _pw.WorkspaceError:return Nonedef _shared_artifact(auth, kind, artifact_id):"""The same result through a shared project, when the client sayswhich (`?project=<construct id>`). Allowlisted shape; None if themembership check refuses."""project = str(request.args.get("project") or "").strip()if not project or not getattr(auth, "token", None):return Nonefrom .core import project_workspaces as _pwtry:got_kind, shaped = _pw.shared_artifact(_auth, auth, project, {"kind": kind, "artifact_id": artifact_id})except _pw.WorkspaceError:return Nonereturn shaped if got_kind == kind else Nonedef _construct_out(row):"""Trim a row for the client. The full DNA/protein is only sent by thesingle-construct GET β the switcher must not ship megabytes."""67 unmodified linesreturn jsonify({"error": "Sign in.", "kind": "signin_required"}), 401row = _auth.get_construct(auth.user_id, construct_id)if not row:# Not theirs. It may be a project somebody SHARED with them: then# it opens like their own (bench, sequence, results), through the# membership check rather than an ownership filter. A refusal or# an unapplied migration reads exactly like before β not found.shared = _shared_construct(auth, construct_id)if shared:return jsonify({"ok": True, "construct": shared})return jsonify({"error": "Not found."}), 404out = _construct_out(row)# Only here, and only for the one the user actually selected.
434 unmodified lines4354364374384394401835 unmodified lines22762277227822792280228122826776 unmodified lines90599060906190629063906490651158 unmodified lines102241022510226102271022810229102303005 unmodified lines132361323713238132391324013241132425183 unmodified lines18426184271842818429184301843158 unmodified lines1849018491184921849318494184951849618497184981849911 unmodified lines185111851218513185141851518516559 unmodified lines1907619077190781907919080190811908219083190841908519086190877 unmodified lines190951909619097190981909919100434 unmodified lines// nav-rail peer anymore, it's what a session starts with.// 'dna' (Evo 2) sits next to 'design': DE designs at the protein level, DNA// Design at the nucleotide level. Same phase of the loop, different molecule.const ROUTES = ['mission', 'collab', 'turing', 'structure', 'plasmid', 'design', 'dna', 'compiler', 'crispr', 'primers', 'docs'];// ββ UI mode flag (Mission-Control-+-Bench re-architecture, 2026-07-13) ββ1835 unmodified linesconst alive = window.TDProject ? window.TDProject.alive() : () => true;let j = {};try {const res = await fetch('/api/library/' + encodeURIComponent(id));j = await res.json().catch(() => ({}));if (!alive()) return;if (res.status === 403) {6776 unmodified linesasync function _loadDesign(id) {const alive = window.TDProject ? window.TDProject.alive() : () => true;try {const res = await fetch('/api/crispr/designs/' + encodeURIComponent(id));const data = await res.json();if (!alive()) return;if (res.status === 403 && data.kind === 'signin_required') { _openSigninModal(); return; }1158 unmodified linesasync function _loadPrimerSet(id) {const alive = window.TDProject ? window.TDProject.alive() : () => true;try {const res = await fetch('/api/primers/analyses/' + encodeURIComponent(id));const data = await res.json();if (!alive()) return;if (res.status === 403 && data.kind === 'signin_required') { window.dispatchEvent(new Event('td:signin-required')); return; }3005 unmodified linesasync function openSaved(id) {const alive = window.TDProject ? window.TDProject.alive() : () => true;try {const res = await fetch('/api/plasmid/library/' + encodeURIComponent(id));const data = await res.json();if (!alive()) return; // the user has opened another projectif (!res.ok || !data.ok) { showErr('Couldnβt open that plasmid.'); return; }5183 unmodified linessetTimeout(() => host.classList.remove('is-entering'), 900);}let _collabFetch = null;async function decorateCollaboration() {if (!_collabFetch) {58 unmodified linesif (repainted[stale.getAttribute('data-construct')]) stale.remove();});}document.querySelectorAll('.mc-cx[data-construct]').forEach((card) => {const p = byId[card.getAttribute('data-construct') || ''];if (!p) return;if (p.collaborative) {// Moved, not copied: the same card node, so it keeps its// thumbnail, status and data-* attributes, and cannot drift// from a duplicate rendered separately.11 unmodified lines: p.pending_invites + ' invitations sent');}});if (shelfSec) shelfSec.hidden = !moved;const shelfN = document.getElementById('mcSharedCount');if (shelfN && moved) {559 unmodified lines} else {grid.innerHTML = projHtml + artHtml ||'<p class="muted">No constructs yet.</p>';// Collaboration belongs ON the work. Deliberately after the grid// is painted and never awaited: a project's own card must not wait// on a collaboration lookup, and an engine without 0056 applied// answers 503 β which has to read as "no shared projects", not as// a broken workspace.try { decorateCollaboration(); } catch (_) {}if (countEl) {// Projects count; they are named pieces of work with a target// and a phase. Recents do not β they live in their own section7 unmodified lines}}// Examples remain available without competing with the user's work.const strip = document.getElementById('mcTryOne');if (strip) {434 unmodified lines4354364374384394404414424434444454464471835 unmodified lines22832284228522862287228822896776 unmodified lines90669067906890699070907190721158 unmodified lines102311023210233102341023510236102373005 unmodified lines132431324413245132461324713248132495183 unmodified lines184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847358 unmodified lines1853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857111 unmodified lines18583185841858518586185871858818589559 unmodified lines1914919150191511915219153191547 unmodified lines191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179434 unmodified lines// nav-rail peer anymore, it's what a session starts with.// 'dna' (Evo 2) sits next to 'design': DE designs at the protein level, DNA// Design at the nucleotide level. Same phase of the loop, different molecule./* Shared projects (0068): a saved result opened inside a project somebodyshared with this account is read through that project's membership check.project.js decides; this only asks, and is a no-op without it. */function _viaProject(url) {try { return (window.TDProject && window.TDProject.via) ? window.TDProject.via(url) : url; }catch (_) { return url; }}const ROUTES = ['mission', 'collab', 'turing', 'structure', 'plasmid', 'design', 'dna', 'compiler', 'crispr', 'primers', 'docs'];// ββ UI mode flag (Mission-Control-+-Bench re-architecture, 2026-07-13) ββ1835 unmodified linesconst alive = window.TDProject ? window.TDProject.alive() : () => true;let j = {};try {const res = await fetch(_viaProject('/api/library/' + encodeURIComponent(id)));j = await res.json().catch(() => ({}));if (!alive()) return;if (res.status === 403) {6776 unmodified linesasync function _loadDesign(id) {const alive = window.TDProject ? window.TDProject.alive() : () => true;try {const res = await fetch(_viaProject('/api/crispr/designs/' + encodeURIComponent(id)));const data = await res.json();if (!alive()) return;if (res.status === 403 && data.kind === 'signin_required') { _openSigninModal(); return; }1158 unmodified linesasync function _loadPrimerSet(id) {const alive = window.TDProject ? window.TDProject.alive() : () => true;try {const res = await fetch(_viaProject('/api/primers/analyses/' + encodeURIComponent(id)));const data = await res.json();if (!alive()) return;if (res.status === 403 && data.kind === 'signin_required') { window.dispatchEvent(new Event('td:signin-required')); return; }3005 unmodified linesasync function openSaved(id) {const alive = window.TDProject ? window.TDProject.alive() : () => true;try {const res = await fetch(_viaProject('/api/plasmid/library/' + encodeURIComponent(id)));const data = await res.json();if (!alive()) return; // the user has opened another projectif (!res.ok || !data.ok) { showErr('Couldnβt open that plasmid.'); return; }5183 unmodified linessetTimeout(() => host.classList.remove('is-entering'), 900);}/* "Editor added the plasmid pEST-A v4 Β· 2 h ago" β the newest change to ashared project, in the same words the bench's history panel uses(history.js), so the card and the panel cannot describe one changetwo ways. */function _changeLine(lc) {const H = window.TDHistory;if (!lc || !H) return '';return '<b>' + mesc(lc.mine ? 'You' : (lc.display_name || 'Somebody')) + '</b> '+ H.sentence(lc) + ' · ' + mesc(H.ago(lc.created_at));}function sharedCardHtml(p) {const owner = '<b>Shared by ' + mesc(p.owner_name || 'a researcher') + '.</b> ';const lc = p.last_change;const text = (lc && window.TDHistory)? _changeLine(lc): owner + 'Open it for the structure, library and results.';const html = cardHtml({kind: 'construct', id: p.id, construct_id: p.id,name: p.name || 'Shared project',phase: Math.max(0, PHASES.indexOf(p.phase)),created_at: p.created_at || p.updated_at, updated_at: p.updated_at, at: p.updated_at,gene: p.gene || '', organism: p.organism || '', uniprot: p.uniprot || '',next: { type: 'shared', text: text, cta: 'Open', route: 'design' },});return html.replace('<button class="mc-cx"', '<button class="mc-cx" data-shared-in="1"');}// Accepting an invitation, leaving, or a revoke seen on #collab changes// what belongs on the shelf. The list is fetched once per page otherwise.window.TDMissionCollabRefresh = function () {_collabFetch = null;try { decorateCollaboration(); } catch (_) {}};let _collabFetch = null;async function decorateCollaboration() {if (!_collabFetch) {58 unmodified linesif (repainted[stale.getAttribute('data-construct')]) stale.remove();});}// 1b. SOMEBODY ELSE'S project, shared with this account.//// Reported 2026-11-16: a project sent to a second account arrived// "with nothing in it", and there was nowhere on Mission Control// to find it. The step above only MOVES cards the portfolio// already painted, and the portfolio is /api/mission β the// caller's own rows. A project somebody else owns was never a// card, so for the person it was shared WITH this shelf stayed// hidden however many projects they had accepted.//// So those are painted here, from the same list, in the same card// the owner sees: the same fold (0068 sends the protein), and// opening it goes through the same path a card of your own does β// the server answers through the membership check instead of an// ownership filter. Repainted from scratch each pass: they are// not in the portfolio, so nothing else will refresh them.if (shelf) {shelf.querySelectorAll('.mc-cx[data-shared-in]').forEach((n) => n.remove());projects.forEach((p) => {if (!p || !p.id || !p.collaborative || p.role === 'owner') return;if (document.querySelector('.mc-cx[data-construct="' + String(p.id).replace(/"/g, '') + '"]')) return;shelf.insertAdjacentHTML('beforeend', sharedCardHtml(p));});}document.querySelectorAll('.mc-cx[data-construct]').forEach((card) => {const p = byId[card.getAttribute('data-construct') || ''];if (!p) return;if (p.collaborative) {// Who changed it last, when that was somebody else: the// owner learns from the card that a collaborator added// something, without opening the project to find out.const lc = p.last_change;const act = card.querySelector('.mc-cx-act-t');if (act && lc && !lc.mine && p.role === 'owner') act.innerHTML = _changeLine(lc);// Moved, not copied: the same card node, so it keeps its// thumbnail, status and data-* attributes, and cannot drift// from a duplicate rendered separately.11 unmodified lines: p.pending_invites + ' invitations sent');}});if (shelf) resolveMcThumbs(shelf);if (shelfSec) shelfSec.hidden = !moved;const shelfN = document.getElementById('mcSharedCount');if (shelfN && moved) {559 unmodified lines} else {grid.innerHTML = projHtml + artHtml ||'<p class="muted">No constructs yet.</p>';if (countEl) {// Projects count; they are named pieces of work with a target// and a phase. Recents do not β they live in their own section7 unmodified lines}}// Collaboration belongs ON the work. Deliberately after the grid is// painted and never awaited: a project's own card must not wait on a// collaboration lookup, and an engine without 0056 applied answers// 503 β which has to read as "no shared projects", not as a broken// workspace.//// For EVERY signed-in account, not only one with work of its own. It// used to run only beside a non-empty portfolio, so the account a// project was shared WITH β typically new, with nothing of its own// yet β never saw the shelf at all.if (!data.gated) { try { decorateCollaboration(); } catch (_) {} }// Examples remain available without competing with the user's work.const strip = document.getElementById('mcTryOne');if (strip) {
204 unmodified lines205206207204 unmodified lines.cb-row { align-items: flex-start; }.cb-do { width: 100%; }}204 unmodified lines205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299204 unmodified lines.cb-row { align-items: flex-start; }.cb-do { width: 100%; }}/* ββ Who changed what β the shared-project chip and history (history.js) ββ** One colour per person, ALWAYS beside their name: the colour makes a long* history scannable, the name makes it readable to anybody who cannot tell* two of these apart. Six muted hues chosen to stay distinct from the* engine's amber (which means "act now") and from the danger red. */:root {--who-0: #2B709C; --who-1: #8A5A00; --who-2: #4F7A28;--who-3: #8E3B6B; --who-4: #5A4FA0; --who-5: #1F7A72;--who-ink: #FFFFFF; /* initials on a person's colour, >= 5:1 on all six */}:root[data-theme="dark"] {--who-0: #7FB6DB; --who-1: #E0B25C; --who-2: #9CC873;--who-3: #DB8DB8; --who-4: #ABA2E8; --who-5: #6CC9BF;--who-ink: #111111;}.hx-who-0 { --who: var(--who-0); } .hx-who-1 { --who: var(--who-1); }.hx-who-2 { --who: var(--who-2); } .hx-who-3 { --who: var(--who-3); }.hx-who-4 { --who: var(--who-4); } .hx-who-5 { --who: var(--who-5); }.bench-shared { position: relative; min-width: 0; }.bench-shared[hidden] { display: none; }.hx-chip {display: inline-flex; align-items: center; gap: 8px;min-height: 32px; padding: 3px 10px 3px 4px;border: 1px solid var(--line-strong, #d9d5cc); border-radius: var(--r-pill, 999px);background: var(--bg-card, #fff); color: var(--ink, #2b2a27);font: 500 .78rem/1 var(--font-ui, system-ui, sans-serif);cursor: pointer; white-space: nowrap; max-width: 100%;}.hx-chip:hover { border-color: var(--line-bold, #b7b1a6); }.hx-chip:focus-visible { outline: 2px solid var(--brand-steel, #2B709C); outline-offset: 2px; }.hx-dots { display: inline-flex; }.hx-dots .hx-dot + .hx-dot { margin-left: -6px; }.hx-dot {display: inline-flex; align-items: center; justify-content: center; flex: none;width: 22px; height: 22px; border-radius: 50%;background: var(--who, var(--who-0)); color: var(--who-ink);border: 2px solid var(--bg-card, #fff);font: 600 .6rem/1 var(--font-ui, system-ui, sans-serif); letter-spacing: .02em;}.hx-panel {position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;width: min(26rem, calc(100vw - 32px)); max-height: min(70vh, 34rem); overflow: auto;padding: 14px 16px 12px;background: var(--bg-raised, #fff); color: var(--ink, #2b2a27);border: 1px solid var(--line-strong, #d9d5cc); border-radius: var(--r-5);box-shadow: 0 12px 32px rgba(0, 0, 0, .14);font: .85rem/1.45 var(--font-ui, system-ui, sans-serif);}.hx-panel[hidden] { display: none; }.hx-panel-h { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }.hx-panel-h strong { font-size: .95rem; overflow-wrap: anywhere; }.hx-x {flex: none; width: 28px; height: 28px; border: 0; border-radius: var(--r-2);background: none; color: inherit; font-size: var(--t-4); line-height: 1; cursor: pointer;}.hx-x:hover { background: var(--bg-hover, #eee); }.hx-note { margin: .4rem 0 .2rem; color: var(--ink-soft, #55524c); font-size: .8rem; }.hx-sub { margin: .9rem 0 .35rem; }.hx-people, .hx-log { list-style: none; margin: 0; padding: 0; }.hx-people { display: flex; flex-wrap: wrap; gap: 6px 14px; }.hx-people li { display: inline-flex; align-items: center; gap: 6px; }.hx-people small { color: var(--ink-faint, #77736b); }.hx-log li {display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start;padding: 7px 0 7px 8px; border-left: 3px solid var(--who, var(--line));margin-left: 2px;}.hx-log li + li { border-top: 1px solid var(--line, #eee); }.hx-what { min-width: 0; overflow-wrap: anywhere; }.hx-what strong { color: var(--who, inherit); }.hx-what code { font-size: .78rem; }.hx-log time { color: var(--ink-faint, #77736b); font-size: .75rem; white-space: nowrap; padding-top: 2px; }.hx-foot { margin: .7rem 0 0; font-size: .8rem; }/* A phone: the chip keeps its dots and loses its words; the panel becomes asheet across the screen rather than a popover hanging off one edge. */@media (max-width: 640px) {.hx-chip-t { display: none; }.hx-chip { padding: 3px; }}/* Mounted on <body> (history.js), above the Turing drawer (40) and belowevery modal (900+), so a sign-in prompt still wins. */.hx-panel.hx-panel--sheet {position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 800;width: auto; max-height: 80vh; border-radius: var(--r-5) var(--r-5) 0 0;padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));box-shadow: 0 -10px 32px rgba(0, 0, 0, .18);}
101 unmodified lines102103104105106107147 unmodified lines255256257258259260101 unmodified lines+ '<div class="cb-what">'+ '<strong>' + esc(i.invited_by || 'A researcher') + ' shared ' + esc(title(i.project_name)) + '</strong>'+ '<small>' + esc(role(i.permission)) + ' access Β· expires ' + esc(day(i.expires_at)) + '</small>'+ '</div><div class="cb-do">'+ button('Accept', 'accept', i.id, {primary: true}) + button('Decline', 'decline', i.id)+ '</div></article>';147 unmodified linesmessage('You have left the project.');}await load();} catch (e) {message(e.message);el.disabled = false;101 unmodified lines102103104105106107108109110111112113114147 unmodified lines262263264265266267268269270271101 unmodified lines+ '<div class="cb-what">'+ '<strong>' + esc(i.invited_by || 'A researcher') + ' shared ' + esc(title(i.project_name)) + '</strong>'+ '<small>' + esc(role(i.permission)) + ' access Β· expires ' + esc(day(i.expires_at)) + '</small>'// Said BEFORE accepting, because it is what accepting agrees to// (0068): an editor's work done inside the project is filed into// it, under their name, without a per-result dialog.+ '<small>' + (i.permission === 'edit'? 'You can edit: what you save inside it is added to the project, under your name.': 'View only: you can open everything in it; what you save stays in your own workspace.')+ ' Your Turing conversations stay private.</small>'+ '</div><div class="cb-do">'+ button('Accept', 'accept', i.id, {primary: true}) + button('Decline', 'decline', i.id)+ '</div></article>';147 unmodified linesmessage('You have left the project.');}await load();// Mission Control's shelf is drawn from the same list, once per// page. A project just joined or left must appear there (or go)// without a reload.if (window.TDMissionCollabRefresh) window.TDMissionCollabRefresh();} catch (e) {message(e.message);el.disabled = false;
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295/* Who changed what β the history of a shared project, on its bench. * * WHY THIS EXISTS * --------------- * Asked for 2026-11-16, after a project shared from one account to another * arrived looking empty: "I need some kind of differentiator system where * the user can actually see who edited what ... who made a change at what * time." The database has recorded actor and time for every collaboration * action since 0056, but never WHAT changed, and nothing showed it anywhere * near the work: it surfaced as a Mission Control feed that has since been * removed and a list inside a dialog. * * 0068 adds the what (project_activity.detail, composed by the database from * the row being changed β a sequence is described by its length, an * invitation by its role, never its address). This module puts it ON the * bench, where the work is: * * * a chip in the bench strip, shown only when the open project is shared: * whose it is, what you can do in it, and a dot per person; * * a panel from the chip: the people, then every change β who, what, * when β newest first. * * ONE COLOUR PER PERSON * --------------------- * The differentiator is colour plus name, never colour alone: each person * keeps one colour everywhere in the panel (their dot in the people list, * every line of theirs in the history), and every line also says their name, * so it reads the same to somebody who cannot tell the colours apart. The * colour is derived from the display name, because the history deliberately * carries no account ids (supabase/tests/shared_projects.cjs). * * WHAT IT DOES NOT DO * ------------------- * Manage people. That is the #collab route's job; the panel links to it. * And it never shows the owner's conversation: the Turing rail is each * person's own (docs/COLLABORATION-AUDIT.md, F4). */(function () { 'use strict';
var ROLE = {edit: 'Editor', read: 'Viewer', owner: 'Owner'}; var KIND = {plasmid: 'plasmid', library: 'variant library', crispr: 'CRISPR design', primer: 'primer set'}; var COLOURS = 6; var generation = 0, data = null, cid = null, wired = false, open = false;
function esc(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) { return {'&': '&', '<': '<', '>': '>', '"': '"', "'": '''}[c]; }); } function $(id) { return document.getElementById(id); }
/* Stable per name: the same person is the same colour on every machine and every reload, without an id to key it on. */ function colour(name) { var s = String(name || '?'), h = 0; for (var i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) >>> 0; return 'hx-who-' + (h % COLOURS); } function initials(name) { var parts = String(name || '?').trim().split(/\s+/).filter(Boolean); return ((parts[0] || '?')[0] + (parts.length > 1 ? parts[parts.length - 1][0] : '')).toUpperCase(); }
function ago(t) { var d = new Date(t); if (isNaN(d)) return ''; var s = Math.max(0, (Date.now() - d.getTime()) / 1000); if (s < 60) return 'just now'; if (s < 3600) return Math.floor(s / 60) + ' min ago'; if (s < 86400) return Math.floor(s / 3600) + ' h ago'; if (s < 86400 * 7) return Math.floor(s / 86400) + ' d ago'; return d.toLocaleDateString(undefined, {day: 'numeric', month: 'short', year: 'numeric'}); } function exact(t) { var d = new Date(t); return isNaN(d) ? '' : d.toLocaleString(undefined, { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit'}); }
/* What a change was, in a sentence after the person's name. Composed from the database's own description (0068) β a field this does not recognise falls back to a plain "updated the project" rather than printing whatever arrived. */ function sentence(a) { var d = a.detail || {}; switch (a.kind) { case 'save': { var bits = []; if (d.name) bits.push('renamed it β' + esc(d.name) + 'β'); if (d.phase) bits.push('moved it to ' + esc(d.phase)); if (d.sequence) { var seq = d.sequence; bits.push('edited the sequence (' + (seq.dna_bp ? Number(seq.dna_bp).toLocaleString() + ' bp' : '') + (seq.dna_bp && seq.protein_aa ? ', ' : '') + (seq.protein_aa ? Number(seq.protein_aa).toLocaleString() + ' aa' : '') + (!seq.dna_bp && !seq.protein_aa ? 'cleared' : '') + ')'); } return bits.length ? bits.join(', ') : 'saved the project'; } case 'contribute': case 'attach': return 'added ' + (KIND[d.kind] ? 'the ' + KIND[d.kind] + ' ' : '') + (d.name ? '<em>' + esc(d.name) + '</em>' : 'a result'); case 'bench': { var b = []; if (d.structure) b.push('put structure <code>' + esc(d.structure) + '</code> on the bench'); if (d.complex) b.push('opened complex <code>' + esc(d.complex) + '</code>'); return b.length ? b.join(' and ') : 'changed the bench'; } case 'measure': return 'logged bench measurements'; case 'invite': return 'invited somebody as ' + esc(ROLE[d.permission] || 'a member'); case 'invitation_accept': return 'joined' + (d.permission ? ' as ' + esc(ROLE[d.permission] || 'a member') : ''); case 'invitation_decline': return 'declined the invitation'; case 'role': return 'made ' + esc(d.member || 'a member') + ' ' + esc(ROLE[d.permission] || 'a member'); case 'revoke': return d.member ? 'removed ' + esc(d.member) : 'withdrew an invitation'; case 'leave': return 'left the project'; default: return 'updated the project'; } }
function people(d) { var p = d.project || {}, out = [{name: p.owner_name || 'The owner', role: 'owner'}]; (d.members || []).forEach(function (m) { if (m.state === 'accepted' && m.display_name) out.push({name: m.display_name, role: m.permission}); }); return out; }
function chip(d) { var p = d.project || {}, who = people(d); var dots = who.slice(0, 4).map(function (x) { return '<span class="hx-dot ' + colour(x.name) + '" title="' + esc(x.name) + '">' + esc(initials(x.name)) + '</span>'; }).join(''); var label = p.role === 'owner' ? 'Shared' : (p.role === 'edit' ? 'Shared Β· can edit' : 'Shared Β· view only'); return '<button type="button" class="hx-chip" id="hxChip" aria-haspopup="dialog" aria-expanded="' + (open ? 'true' : 'false') + '" aria-controls="hxPanel">' + '<span class="hx-dots" aria-hidden="true">' + dots + '</span>' + '<span class="hx-chip-t">' + esc(label) + '</span></button>'; }
function note(p) { if (p.role === 'owner') { return 'You own this project. Everyone in it opens this bench β the structure, library and results β ' + 'and every change is listed here with who made it. Your Turing conversation stays yours.'; } if (p.role === 'edit') { return 'Owned by ' + esc(p.owner_name || 'a researcher') + '. You can edit: what you save here is added to the project ' + 'for everyone in it, under your name. Your Turing conversation stays yours.'; } return 'Owned by ' + esc(p.owner_name || 'a researcher') + '. View only: what you save here stays in your own workspace.'; }
function panel(d) { var p = d.project || {}; var who = people(d).map(function (x) { return '<li><span class="hx-dot ' + colour(x.name) + '" aria-hidden="true">' + esc(initials(x.name)) + '</span>' + '<span class="hx-nm">' + esc(x.name) + '</span><small>' + esc(ROLE[x.role] || 'Viewer') + '</small></li>'; }).join(''); var rows = (d.activity || []).map(function (a) { var name = a.mine ? 'You' : (a.display_name || 'Somebody'); var tone = colour(a.display_name || name); return '<li class="hx-row ' + tone + '">' + '<span class="hx-dot ' + tone + '" aria-hidden="true">' + esc(initials(a.display_name || name)) + '</span>' + '<span class="hx-what"><strong>' + esc(name) + '</strong> ' + sentence(a) + '</span>' + '<time datetime="' + esc(a.created_at) + '" title="' + esc(exact(a.created_at)) + '">' + esc(ago(a.created_at)) + '</time>' + '</li>'; }).join(''); return '<div class="hx-panel-h"><strong>' + esc(p.name || 'Shared project') + '</strong>' + '<button type="button" class="hx-x" id="hxClose" aria-label="Close">×</button></div>' + '<p class="hx-note">' + note(p) + '</p>' + '<p class="micro hx-sub">People</p><ul class="hx-people">' + who + '</ul>' + '<p class="micro hx-sub">History</p>' + (rows ? '<ol class="hx-log">' + rows + '</ol>' : '<p class="hx-note">No changes recorded yet.</p>') + '<p class="hx-foot"><a href="#collab">Manage people →</a></p>'; }
/* On a phone the panel is a sheet, and it cannot live in the bench strip: everything under .app is one stacking layer (z-index 1), below the Turing drawer (40), so a sheet drawn there slid UNDER the drawer and its last lines were unreachable. It is mounted on <body> instead. */ var PHONE = window.matchMedia ? window.matchMedia('(max-width: 640px)') : null; function layer() { var l = $('hxLayer'); if (!l) { l = document.createElement('div'); l.id = 'hxLayer'; document.body.appendChild(l); } return l; } function paint() { var host = $('benchShared'); if (!host) return; var sheet = !!(PHONE && PHONE.matches); var l = $('hxLayer'); if (l) l.innerHTML = ''; if (!data) { host.hidden = true; host.innerHTML = ''; return; } host.hidden = false; var box = '<div class="hx-panel' + (sheet ? ' hx-panel--sheet' : '') + '" id="hxPanel" role="dialog" aria-label="Who changed what"' + (open ? '' : ' hidden') + '>' + (open ? panel(data) : '') + '</div>'; host.innerHTML = chip(data) + (sheet ? '' : box); if (sheet && open) layer().innerHTML = box; }
/* A project is shown as shared when somebody other than its owner can open it β the same rule as 0067's `collaborative`: the caller is a member, or the owner has at least one accepted member. */ function isShared(d) { var p = (d && d.project) || {}; if (!p.id) return false; if (p.role && p.role !== 'owner') return true; return (d.members || []).some(function (m) { return m.state === 'accepted'; }); }
async function load(id) { var ticket = ++generation; cid = id; data = null; open = false; paint(); if (!id) return; try { var r = await fetch('/api/workspaces/' + encodeURIComponent(id)); if (!r.ok) return; // not shared, not signed in, or 0056 missing var d = await r.json(); if (ticket !== generation) return; data = isShared(d) ? d : null; paint(); } catch (e) { /* the bench without a history chip is the bench as it was */ } }
function wire() { if (wired) return; wired = true; document.addEventListener('click', function (e) { var host = $('benchShared'); if (!host || host.hidden) return; if (e.target.closest('#hxPanel a[href="#collab"]')) { open = false; paint(); return; } if (e.target.closest('#hxChip')) { open = !open; paint(); // Fresh on open: an editor may have filed work since the chip // was drawn, and the panel is where they look for it. if (open && cid) { var ticket = generation; fetch('/api/workspaces/' + encodeURIComponent(cid)) .then(function (r) { return r.ok ? r.json() : null; }) .then(function (d) { if (d && ticket === generation && open) { data = isShared(d) ? d : data; paint(); } }).catch(function () {}); } return; } if (e.target.closest('#hxClose') || (open && !e.target.closest('#benchShared, #hxLayer'))) { if (open) { open = false; paint(); } } }); document.addEventListener('keydown', function (e) { if (e.key === 'Escape' && open) { open = false; paint(); var c = $('hxChip'); if (c) c.focus(); } }); }
// Rotating a phone, or resizing a window across the breakpoint, moves // an open panel between popover and sheet. if (PHONE && PHONE.addEventListener) PHONE.addEventListener('change', function () { if (data) paint(); });
function onProject(kind, detail) { if (kind !== 'enter') return; var P = window.TDProject; var id = P && P.constructIdOf ? P.constructIdOf(detail.key) : null; load(id); }
function boot() { wire(); var P = window.TDProject; if (!P || !P.on) return; P.on(onProject); // A reload lands straight on a project's bench: TDProject restored // the scope before this module could listen for it. var key = P.key && P.key(); var id = key && P.constructIdOf ? P.constructIdOf(key) : null; if (id) load(id); }
window.TDHistory = { refresh: function () { if (cid) load(cid); }, // Exposed for tests and for the Mission Control card, which shows the // newest change with the same words the panel uses. sentence: sentence, colour: colour, initials: initials, ago: ago, };
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot); else boot();}());236 unmodified lines237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276512 unmodified lines7897907917927937942842 unmodified lines3637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836991 unmodified line370137023703370437053706236 unmodified linescritical path is an availability dependency we don't control.Top-level, not a subdirectory: /static/<path> only minifies andhard-caches assets with no slash in the name. --><link rel="stylesheet" href="/static/open-props-1.7.23.min.css?v=20261116-shared-objects" /><link rel="stylesheet" href="/static/app.css?v=20261116-shared-objects" /><!-- The work catalog + the draggable rail. Kept out of app.css so two newself-contained surfaces stay reviewable; every colour is an app.csstoken, so both themes work with nothing added. --><link rel="stylesheet" href="/static/catalog.css?v=20261116-shared-objects" /><!-- Units, the run strip and the decision trace. Same reasoning ascatalog.css: kept out of app.css so a self-contained surface staysreviewable, and every colour is an app.css token so both themeswork with nothing added. --><link rel="stylesheet" href="/static/trace.css?v=20261116-shared-objects" /><!-- Disclosure surfaces added in the 2026-08 scientific review (CRISPRscope strip, provenance "Assumes" line). Separate file for the samereason as catalog.css: small, self-contained, and app.css's cascadeis hostile. Uses app.css tokens only, so both themes work. --><link rel="stylesheet" href="/static/science.css?v=20261116-shared-objects" /><link rel="stylesheet" href="/static/workbench.css?v=20261116-shared-objects" /><link rel="stylesheet" href="/static/workspaces.css?v=20261116-shared-objects" /><link rel="stylesheet" href="/static/collab.css?v=20261116-shared-objects" /><link rel="stylesheet" href="/static/interaction.css?v=20261116-shared-objects" /><link rel="stylesheet" href="/static/referrals.css?v=20261116-shared-objects" /><link rel="stylesheet" href="/static/onboarding.css?v=20261116-shared-objects" /><!-- Light, depth and a signature per instrument. After the componentsheets so it can lift them; before motion.css and accent.css, whichkeep the last word on Mission Control's motion and on amber. --><link rel="stylesheet" href="/static/atmosphere.css?v=20261116-shared-objects" /><!-- Depth + motion for Mission Control. LAST: it refines .mc-* rules thatapp.css already defines at the same specificity, so it has to win onorder rather than by inflating selectors. Sets no colour. --><link rel="stylesheet" href="/static/motion.css?v=20261116-shared-objects" /><!-- The secondary colour (the landing amber) by role: the key action,where you are, and selection. LAST, for the same reason asmotion.css: it overrides colours set earlier at equal specificity. --><link rel="stylesheet" href="/static/accent.css?v=20261116-shared-objects" /><link rel="icon" type="image/svg+xml" href="/static/favicon.svg?v=5" /><link rel="apple-touch-icon" sizes="180x180" href="/static/apple-touch-icon.png?v=3" /><!-- Mol* (PDBe) 3-D viewer is ~4.9 MB. We do NOT eager-load it on every512 unmodified linesmade five, the chip wrapped onto a second row inside the tabbar, and its menu opened leftward under the Turing rail. --><div class="bench-strip-end"><span data-engine-notifications hidden></span><div class="bench-account" id="benchAccount" hidden><button type="button" class="bench-acct-trigger" id="benchAcctTrigger"2842 unmodified linesAuthorization header on every same-origin /api/* call. Withoutthis, signed-in users would still hit the anonymous-quotagate. --><script src="/static/notifications.js?v=20261116-shared-objects"></script><script src="/static/auth.js?v=20261116-shared-objects"></script><!-- Checkout runs on the approved turingdna.com origin, outside this iframe. --><script src="/static/billing.js?v=20261116-shared-objects" defer></script><!-- Cloning reference data must load before app.js so the Designercan read VECTORS / ENZYMES / CLONING_METHODS / TAGS / LINKERS. --><script src="/static/cloning_db.js?v=20261116-shared-objects" defer></script><!-- Before context.js and tabs.js: which project the bench is in decideswhere each tool keeps its state (tabs.js reads it at mount). --><script src="/static/project.js?v=20261116-shared-objects" defer></script><script src="/static/context.js?v=20261116-shared-objects" defer></script><script src="/static/lineage.js?v=20261116-shared-objects" defer></script><!-- Before app.js: it mounts a strip at init. Both are `defer`, so theyrun in document order. --><script src="/static/tabs.js?v=20261116-shared-objects" defer></script><!-- Also before app.js, for the same document-order reason: app.jsregisters its perception provider as it parses. A missingTDPerception is survivable by design β the agent is then blind tothe bench rather than the page being broken β but loading it latewould make that the normal case. --><script src="/static/perception.js?v=20261116-shared-objects" defer></script><script src="/static/app.js?v=20261116-shared-objects" defer></script><!-- The decision trace, BEFORE cockpit.js: applyEvent calls TDTrace.pushon the very first event, and both are `defer`, so document order isload order. Loading it after would drop the opening events of arestored run on the floor β silently, since the push is guarded. --><script src="/static/trace.js?v=20261116-shared-objects" defer></script><!-- THE COCKPIT β the persistent orchestrator rail. Loads after app.js soTDBench/TDStructure exist when a tool result asks the workspace torender something. This is the only conversation surface in the app. --><script src="/static/decisions.js?v=20261116-shared-objects" defer></script><script src="/static/cockpit.js?v=20261116-shared-objects" defer></script><!-- structcard before catalog: the catalog calls TDStructCard.observe assoon as it paints. Both are defer, so document order is load order. --><script src="/static/structcard.js?v=20261116-shared-objects" defer></script><!-- After app.js on purpose: it reuses that file's Mol* helpers(ensureMolstar, _afCreateViewer, _afRefit, _afShowError) rather thanstanding up a second viewer. --><script src="/static/interaction.js?v=20261116-shared-objects" defer></script><script src="/static/catalog.js?v=20261116-shared-objects" defer></script><script src="/static/workspaces.js?v=20261116-shared-objects" defer></script><script src="/static/collab.js?v=20261116-shared-objects" defer></script><script src="/static/referrals.js?v=20261116-shared-objects" defer></script><!-- Getting started (0064). After referrals.js, whose dialog two of itssteps open; it starts on auth.js's td:account event, not at load. --><script src="/static/onboarding.js?v=20261116-shared-objects" defer></script><script src="/static/atmosphere.js?v=20261116-shared-objects" defer></script><script src="/static/railsplit.js?v=20261116-shared-objects" defer></script><!-- Dwell-time heartbeat. Loads after auth.js so its /api/ping calls gothrough the JWT-attaching fetch wrapper (signed-in attribution). --><script src="/static/telemetry.js?v=20261116-shared-objects" defer></script><!-- First-party UX-behaviour collector (dead/rage clicks, scroll depth,funnel steps, feature clicks, client errors). Structure-only, neverreads sequence content; shares telemetry.js's persisted td_session_idand POSTs batches to /api/collect via sendBeacon. First-party /staticfile so it satisfies the strict script-src CSP. --><script src="/static/collector.js?v=20261116-shared-objects" defer></script><!-- PostHog, loaded LAST on purpose. It chains window.fetch to turn asuccessful API call into a named product event, and auth.js and1 unmodified lineso it observes the response the user actually got rather than one oftheirs mid-flight. See dee/static/posthog.js for why autocapture andsession replay are off and must stay off. --><script src="/static/posthog.js?v=20261116-shared-objects" defer></script></body></html>236 unmodified lines237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276512 unmodified lines7897907917927937947957967977982842 unmodified lines36413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337041 unmodified line370637073708370937103711236 unmodified linescritical path is an availability dependency we don't control.Top-level, not a subdirectory: /static/<path> only minifies andhard-caches assets with no slash in the name. --><link rel="stylesheet" href="/static/open-props-1.7.23.min.css?v=20261116-shared-projects" /><link rel="stylesheet" href="/static/app.css?v=20261116-shared-projects" /><!-- The work catalog + the draggable rail. Kept out of app.css so two newself-contained surfaces stay reviewable; every colour is an app.csstoken, so both themes work with nothing added. --><link rel="stylesheet" href="/static/catalog.css?v=20261116-shared-projects" /><!-- Units, the run strip and the decision trace. Same reasoning ascatalog.css: kept out of app.css so a self-contained surface staysreviewable, and every colour is an app.css token so both themeswork with nothing added. --><link rel="stylesheet" href="/static/trace.css?v=20261116-shared-projects" /><!-- Disclosure surfaces added in the 2026-08 scientific review (CRISPRscope strip, provenance "Assumes" line). Separate file for the samereason as catalog.css: small, self-contained, and app.css's cascadeis hostile. Uses app.css tokens only, so both themes work. --><link rel="stylesheet" href="/static/science.css?v=20261116-shared-projects" /><link rel="stylesheet" href="/static/workbench.css?v=20261116-shared-projects" /><link rel="stylesheet" href="/static/workspaces.css?v=20261116-shared-projects" /><link rel="stylesheet" href="/static/collab.css?v=20261116-shared-projects" /><link rel="stylesheet" href="/static/interaction.css?v=20261116-shared-projects" /><link rel="stylesheet" href="/static/referrals.css?v=20261116-shared-projects" /><link rel="stylesheet" href="/static/onboarding.css?v=20261116-shared-projects" /><!-- Light, depth and a signature per instrument. After the componentsheets so it can lift them; before motion.css and accent.css, whichkeep the last word on Mission Control's motion and on amber. --><link rel="stylesheet" href="/static/atmosphere.css?v=20261116-shared-projects" /><!-- Depth + motion for Mission Control. LAST: it refines .mc-* rules thatapp.css already defines at the same specificity, so it has to win onorder rather than by inflating selectors. Sets no colour. --><link rel="stylesheet" href="/static/motion.css?v=20261116-shared-projects" /><!-- The secondary colour (the landing amber) by role: the key action,where you are, and selection. LAST, for the same reason asmotion.css: it overrides colours set earlier at equal specificity. --><link rel="stylesheet" href="/static/accent.css?v=20261116-shared-projects" /><link rel="icon" type="image/svg+xml" href="/static/favicon.svg?v=5" /><link rel="apple-touch-icon" sizes="180x180" href="/static/apple-touch-icon.png?v=3" /><!-- Mol* (PDBe) 3-D viewer is ~4.9 MB. We do NOT eager-load it on every512 unmodified linesmade five, the chip wrapped onto a second row inside the tabbar, and its menu opened leftward under the Turing rail. --><div class="bench-strip-end"><!-- Shared project: whose it is, what you can do, and whochanged what (history.js, 0068). Hidden for your ownunshared work. --><div class="bench-shared" id="benchShared" hidden></div><span data-engine-notifications hidden></span><div class="bench-account" id="benchAccount" hidden><button type="button" class="bench-acct-trigger" id="benchAcctTrigger"2842 unmodified linesAuthorization header on every same-origin /api/* call. Withoutthis, signed-in users would still hit the anonymous-quotagate. --><script src="/static/notifications.js?v=20261116-shared-projects"></script><script src="/static/auth.js?v=20261116-shared-projects"></script><!-- Checkout runs on the approved turingdna.com origin, outside this iframe. --><script src="/static/billing.js?v=20261116-shared-projects" defer></script><!-- Cloning reference data must load before app.js so the Designercan read VECTORS / ENZYMES / CLONING_METHODS / TAGS / LINKERS. --><script src="/static/cloning_db.js?v=20261116-shared-projects" defer></script><!-- Before context.js and tabs.js: which project the bench is in decideswhere each tool keeps its state (tabs.js reads it at mount). --><script src="/static/project.js?v=20261116-shared-projects" defer></script><script src="/static/context.js?v=20261116-shared-projects" defer></script><script src="/static/lineage.js?v=20261116-shared-projects" defer></script><!-- Before app.js: it mounts a strip at init. Both are `defer`, so theyrun in document order. --><script src="/static/tabs.js?v=20261116-shared-projects" defer></script><!-- Also before app.js, for the same document-order reason: app.jsregisters its perception provider as it parses. A missingTDPerception is survivable by design β the agent is then blind tothe bench rather than the page being broken β but loading it latewould make that the normal case. --><script src="/static/perception.js?v=20261116-shared-projects" defer></script><script src="/static/app.js?v=20261116-shared-projects" defer></script><!-- The decision trace, BEFORE cockpit.js: applyEvent calls TDTrace.pushon the very first event, and both are `defer`, so document order isload order. Loading it after would drop the opening events of arestored run on the floor β silently, since the push is guarded. --><script src="/static/trace.js?v=20261116-shared-projects" defer></script><!-- THE COCKPIT β the persistent orchestrator rail. Loads after app.js soTDBench/TDStructure exist when a tool result asks the workspace torender something. This is the only conversation surface in the app. --><script src="/static/decisions.js?v=20261116-shared-projects" defer></script><script src="/static/cockpit.js?v=20261116-shared-projects" defer></script><!-- structcard before catalog: the catalog calls TDStructCard.observe assoon as it paints. Both are defer, so document order is load order. --><script src="/static/structcard.js?v=20261116-shared-projects" defer></script><!-- After app.js on purpose: it reuses that file's Mol* helpers(ensureMolstar, _afCreateViewer, _afRefit, _afShowError) rather thanstanding up a second viewer. --><script src="/static/interaction.js?v=20261116-shared-projects" defer></script><script src="/static/catalog.js?v=20261116-shared-projects" defer></script><script src="/static/workspaces.js?v=20261116-shared-projects" defer></script><script src="/static/collab.js?v=20261116-shared-projects" defer></script><script src="/static/history.js?v=20261116-shared-projects" defer></script><script src="/static/referrals.js?v=20261116-shared-projects" defer></script><!-- Getting started (0064). After referrals.js, whose dialog two of itssteps open; it starts on auth.js's td:account event, not at load. --><script src="/static/onboarding.js?v=20261116-shared-projects" defer></script><script src="/static/atmosphere.js?v=20261116-shared-projects" defer></script><script src="/static/railsplit.js?v=20261116-shared-projects" defer></script><!-- Dwell-time heartbeat. Loads after auth.js so its /api/ping calls gothrough the JWT-attaching fetch wrapper (signed-in attribution). --><script src="/static/telemetry.js?v=20261116-shared-projects" defer></script><!-- First-party UX-behaviour collector (dead/rage clicks, scroll depth,funnel steps, feature clicks, client errors). Structure-only, neverreads sequence content; shares telemetry.js's persisted td_session_idand POSTs batches to /api/collect via sendBeacon. First-party /staticfile so it satisfies the strict script-src CSP. --><script src="/static/collector.js?v=20261116-shared-projects" defer></script><!-- PostHog, loaded LAST on purpose. It chains window.fetch to turn asuccessful API call into a named product event, and auth.js and1 unmodified lineso it observes the response the user actually got rather than one oftheirs mid-flight. See dee/static/posthog.js for why autocapture andsession replay are off and must stay off. --><script src="/static/posthog.js?v=20261116-shared-projects" defer></script></body></html>
158 unmodified lines1591601611621631641651661671681691701 unmodified line172173174175176177178299 unmodified lines478479480481482483484485158 unmodified lines// give it the sequence now (prefill only fills an EMPTY input).try { window.TDContext.prefill(currentRoute()); } catch (e) {}}var ws = c.workspace || {};var local = recordOf(key);var changed = {};// The newer copy wins, field by field; a field only one side// has is taken from that side.var serverNewer = (ws.at || 0) > (local.at || 0);SYNCED.forEach(function (f) {if (ws[f] == null) return;if (local[f] == null || (serverNewer && JSON.stringify(ws[f]) !== JSON.stringify(local[f]))) {1 unmodified line}});if (c.library_id && !local.library && !changed.library) changed.library = c.library_id;if (!Object.keys(changed).length) return;patchRecord(key, changed);// Tools that already looked and found nothing get another go.if (changed.structure || changed.interaction) delete attempted.structure;299 unmodified linesreturn out;}]);window.TDProject = {key: function () { return current; },constructId: constructId,// The server is still being asked what this project had on screen.resuming: function () { return !!current && resuming === current; },158 unmodified lines1591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961 unmodified line198199200201202203204299 unmodified lines504505506507508509510511512513514515516517518519520521522523524525526527528529530158 unmodified lines// give it the sequence now (prefill only fills an EMPTY input).try { window.TDContext.prefill(currentRoute()); } catch (e) {}}/* A project somebody SHARED with this account (0068): theserver answered through the membership check, and says so.Its results are listed by the server rather than by aMission Control card, so they become this project'smembers here β which is what each tab's fill opens. */if (c.shared) {info.shared = c.shared;if (c.members && typeof c.members === 'object') {info.members = c.members;patchRecord(key, { members: c.members });['design', 'plasmid', 'crispr', 'primer'].forEach(function (t) { delete attempted[t]; });}var ident = c.identity || {};if (ident.uniprot && !info.uniprot) {info.uniprot = ident.uniprot;info.gene = info.gene || ident.gene || '';info.organism = info.organism || ident.organism || '';}emit('shared', { key: key, shared: c.shared });}var ws = c.workspace || {};// A shared project's library is the project's NEWEST one β// an editor's round 2 included β not whichever the owner last// had on screen.if (c.shared && c.library_id) ws = Object.assign({}, ws, { library: c.library_id });var local = recordOf(key);var changed = {};// The newer copy wins, field by field; a field only one side// has is taken from that side. In a project somebody else// owns, the server always wins: it is the bench everyone in// the project opens, and this browser cannot write to it.var serverNewer = !!(c.shared && c.shared.role !== 'owner') || (ws.at || 0) > (local.at || 0);SYNCED.forEach(function (f) {if (ws[f] == null) return;if (local[f] == null || (serverNewer && JSON.stringify(ws[f]) !== JSON.stringify(local[f]))) {1 unmodified line}});if (c.library_id && !local.library && !changed.library) changed.library = c.library_id;if (!Object.keys(changed).length) { if (c.shared) refillShown(); return; }patchRecord(key, changed);// Tools that already looked and found nothing get another go.if (changed.structure || changed.interaction) delete attempted.structure;299 unmodified linesreturn out;}]);/* A saved result's URL, told which project it is being opened in.Every tab's loader reads its result through an owner-only route.Inside a project somebody shared with this account those results arethe OWNER's, so the route found nothing and the tab stayed empty β therecipient's half of "the project arrived with nothing in it". With theproject named, the server falls back (only when its owner lookup foundnothing) to the membership check that authorizes exactly the resultslinked into that project. For the owner the parameter changes nothing. */function via(url) {var cid = (!parked && current) ? constructIdOf(current) : null;if (!cid) return url;return url + (url.indexOf('?') >= 0 ? '&' : '?') + 'project=' + encodeURIComponent(cid);}window.TDProject = {key: function () { return current; },// The open project's sharing: {role, owner_name, revision}, or null// for the account's own work.shared: function () { return (current && info && info.shared) || null; },via: via,constructId: constructId,// The server is still being asked what this project had on screen.resuming: function () { return !!current && resuming === current; },
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441"""A project shared with you opens like your own, and says who changed what.
Reported 2026-11-16: a project sent from one account to a second arrived"with nothing in it". docs/COLLABORATION-AUDIT.md traced why; the owner thenasked for the fix in their own words β a shared project should open from therecipient's Mission Control "the same way as somebody would open it if it wastheir research", with its structure, library and DNA map, and "some kind ofdifferentiator system where users can actually see who edited what ... whomade change at what time".
The database half (0068) is proven against real PostgreSQL insupabase/tests/shared_projects.cjs. This file pins the engine half:
* the owner's path always runs first and is unchanged; the shared path only answers when it found nothing, only through the membership RPC with the caller's JWT, and a refusal reads as "not found"; * the four tab loaders take `?project=` and fall back the same way, with the same allowlisted shapes the collaboration route has always used; * the owner's conversation never crosses, whatever the RPC returns; * work saved inside a project the caller EDITS is filed into it through the engine-only function, acting for the verified session user; * the client asks for all of this: Mission Control paints shared-with-me cards for every signed-in account, the loaders name the project, and the bench shows the history."""import jsonimport pathlibimport reimport shutilimport subprocessfrom types import SimpleNamespace
import pytest
from dee import auth as Afrom dee import serverfrom dee.core import project_workspaces as ws
PROJECT = '00000000-0000-4000-8000-000000000010'ART = '00000000-0000-4000-8000-000000000020'ROOT = pathlib.Path(__file__).resolve().parent.parentSTATIC = ROOT / 'dee' / 'static'
def _read(name): return (STATIC / name).read_text(encoding='utf-8')
@pytest.fixturedef client(monkeypatch): monkeypatch.setattr(server._auth, 'get_auth', lambda: SimpleNamespace(anonymous=False, user_id='recipient', token='recipient-jwt')) return server.create_app().test_client()
def _get_reply(**over): project = { 'id': PROJECT, 'name': 'estA rescue', 'phase': 'Build', 'revision': 7, 'role': 'edit', 'sequence_dna': 'ACGTACGT', 'wt_protein': '', 'owner_name': 'Owner', 'created_at': '2026-11-01T00:00:00Z', 'updated_at': '2026-11-16T00:00:00Z', 'library_id': ART, 'plasmid_ids': [ART, 'forged-not-listed'], 'identity': {'uniprot': 'P0A7B8', 'gene': 'estA', 'organism': 'E. coli'}, 'bench': {'structure': {'acc': 'P0A7B8', 'gene': 'estA', 'org': 'E. coli', 'src': 'tool'}, 'interaction': {'kind': 'experimental', 'pdb': {'pdb_id': '6VXX', 'assembly': '1'}}, 'library': ART, 'at': 1763300000000}, } project.update(over) return {'project': project, 'results': [{'kind': 'plasmid', 'id': ART, 'name': 'pEST', 'added_by': 'Owner', 'mine': False}, {'kind': 'library', 'id': ART, 'name': 'Round 1', 'added_by': 'Owner', 'mine': False}], 'members': [], 'activity': []}
# ββ the project itself βββββββββββββββββββββββββββββββββββββββββββββββββββ
def test_a_project_shared_with_you_opens_through_the_membership_check(client, monkeypatch): monkeypatch.setattr(server._auth, 'get_construct', lambda uid, cid: None) calls = []
def rpc(auth_module, auth, action, project_id=None, payload=None): calls.append((auth.token, action, project_id)) return _get_reply() monkeypatch.setattr(ws, 'rpc', rpc)
r = client.get('/api/constructs/' + PROJECT) assert r.status_code == 200 c = r.json['construct'] assert calls == [('recipient-jwt', 'get', PROJECT)], 'the CALLER\'s JWT, one membership read' assert c['sequence_dna'] == 'ACGTACGT' assert c['workspace']['structure']['acc'] == 'P0A7B8' assert c['workspace']['interaction']['pdb']['pdb_id'] == '6VXX' assert c['workspace']['library'] == ART assert c['shared'] == {'role': 'edit', 'owner_name': 'Owner', 'revision': 7} assert c['identity'] == {'uniprot': 'P0A7B8', 'gene': 'estA', 'organism': 'E. coli'} # Members come from the RESULTS the RPC listed β the ones its artifact # rule will authorize β never from the raw id arrays. assert c['members'] == {'plasmid': [ART], 'library': [ART]} assert 'forged-not-listed' not in r.text
def test_the_owners_conversation_never_crosses_even_if_the_rpc_sent_it(client, monkeypatch): monkeypatch.setattr(server._auth, 'get_construct', lambda uid, cid: None) reply = _get_reply() reply['project']['bench']['run'] = 'run-owner-private' monkeypatch.setattr(ws, 'rpc', lambda *a, **k: reply) r = client.get('/api/constructs/' + PROJECT) assert r.status_code == 200 assert 'run' not in r.json['construct']['workspace'] assert 'run-owner-private' not in r.text
def test_a_malformed_bench_pointer_is_dropped_by_the_owners_own_validator(client, monkeypatch): monkeypatch.setattr(server._auth, 'get_construct', lambda uid, cid: None) reply = _get_reply(bench={'structure': {'acc': '<img src=x>'}, 'library': 'not-a-uuid', 'interaction': {'kind': 'docked', 'pdb': {'pdb_id': '6VXX'}}}) monkeypatch.setattr(ws, 'rpc', lambda *a, **k: reply) assert client.get('/api/constructs/' + PROJECT).json['construct']['workspace'] == {}
def test_your_own_project_never_asks_the_membership_rpc(client, monkeypatch): monkeypatch.setattr(server._auth, 'get_construct', lambda uid, cid: {'id': cid, 'name': 'Mine', 'sequence_dna': 'ACGT', 'meta': {}}) monkeypatch.setattr(ws, 'rpc', lambda *a, **k: pytest.fail('owner path must not consult sharing')) r = client.get('/api/constructs/' + PROJECT) assert r.status_code == 200 assert 'shared' not in r.json['construct']
def test_a_refusal_reads_as_not_found(client, monkeypatch): monkeypatch.setattr(server._auth, 'get_construct', lambda uid, cid: None)
def refused(*a, **k): raise ws.WorkspaceError('Project or invitation unavailable.', 403) monkeypatch.setattr(ws, 'rpc', refused) r = client.get('/api/constructs/' + PROJECT) assert r.status_code == 404 assert 'invitation' not in r.text.lower(), 'a refusal must not confirm the project exists'
def test_no_token_means_no_shared_read(client, monkeypatch): monkeypatch.setattr(server._auth, 'get_auth', lambda: SimpleNamespace(anonymous=False, user_id='recipient', token=None)) monkeypatch.setattr(server._auth, 'get_construct', lambda uid, cid: None) monkeypatch.setattr(ws, 'rpc', lambda *a, **k: pytest.fail('no JWT, no membership read')) assert client.get('/api/constructs/' + PROJECT).status_code == 404
# ββ the four tab loaders βββββββββββββββββββββββββββββββββββββββββββββββββ
def _artifact_rpc(kind, calls): def rpc(auth_module, auth, action, project_id=None, payload=None): calls.append((action, project_id, dict(payload or {}))) return {'owner_id': 'real-owner', 'artifact_id': ART, 'kind': kind} return rpc
def test_a_shared_plasmid_opens_in_the_editor_with_its_objects(client, monkeypatch): calls = [] monkeypatch.setattr(ws, 'rpc', _artifact_rpc('plasmid', calls))
def get_plasmid(owner, pid): if owner == 'recipient': return None assert (owner, pid) == ('real-owner', ART) return {'id': pid, 'name': 'pEST', 'sequence': 'ACGT', 'features': [], 'topology': 'circular', 'meta': {'private': 'owner notes', 'objects': {}}, 'storage_path': 'secret/path', 'user_id': owner} monkeypatch.setattr(server._auth, 'get_plasmid', get_plasmid) r = client.get('/api/plasmid/library/' + ART + '?project=' + PROJECT) assert r.status_code == 200 assert r.json['shared'] is True assert set(r.json['plasmid']) == {'id', 'name', 'sequence', 'features', 'topology'} assert set(r.json['objects']) == {'primer', 'digest', 'alignment'} assert 'owner notes' not in r.text and 'secret' not in r.text and 'real-owner' not in r.text # Authorized, loaded, and authorized AGAIN after the load. assert [c[0] for c in calls] == ['artifact', 'artifact'] assert calls[0][2] == {'kind': 'plasmid', 'artifact_id': ART} assert calls[0][1] == PROJECT
def test_without_naming_a_project_nothing_changes(client, monkeypatch): monkeypatch.setattr(server._auth, 'get_plasmid', lambda owner, pid: None) monkeypatch.setattr(ws, 'rpc', lambda *a, **k: pytest.fail('no project named, no membership read')) assert client.get('/api/plasmid/library/' + ART).status_code == 404
def test_your_own_plasmid_is_served_as_before_even_with_a_project_named(client, monkeypatch): monkeypatch.setattr(server._auth, 'get_plasmid', lambda owner, pid: {'id': pid, 'sequence': 'ACGT', 'meta': {}} if owner == 'recipient' else None) monkeypatch.setattr(ws, 'rpc', lambda *a, **k: pytest.fail('owner path first, always')) r = client.get('/api/plasmid/library/' + ART + '?project=' + PROJECT) assert r.status_code == 200 assert 'shared' not in r.json
def test_a_kind_mismatch_is_refused(client, monkeypatch): calls = [] monkeypatch.setattr(ws, 'rpc', _artifact_rpc('primer', calls)) monkeypatch.setattr(server._auth, 'get_plasmid', lambda owner, pid: None) monkeypatch.setattr(server._auth, 'get_primer_analysis', lambda owner, aid: {'id': aid, 'result': {}}) assert client.get('/api/plasmid/library/' + ART + '?project=' + PROJECT).status_code == 404
def test_shared_crispr_primer_and_library_tabs_fill(client, monkeypatch): for kind, attr, url, key in ( ('crispr', 'get_crispr_design', '/api/crispr/designs/', 'design'), ('primer', 'get_primer_analysis', '/api/primers/analyses/', 'analysis'), ): calls = [] monkeypatch.setattr(ws, 'rpc', _artifact_rpc(kind, calls)) monkeypatch.setattr(server._auth, attr, lambda owner, aid: None if owner == 'recipient' else { 'id': aid, 'label': 'L', 'guides': [], 'result': {'primers': []}, 'meta': {'private': 1}, 'user_id': owner, 'input_seq': 'SECRET-INPUT'}) r = client.get(url + ART + '?project=' + PROJECT) assert r.status_code == 200, kind assert r.json['shared'] is True and r.json[key]['id'] == ART assert 'private' not in r.text and 'SECRET-INPUT' not in r.text and 'real-owner' not in r.text
calls = [] monkeypatch.setattr(ws, 'rpc', _artifact_rpc('library', calls)) monkeypatch.setattr(server._auth, 'load_library', lambda owner, lid: None if owner == 'recipient' else { 'library_id': lid, 'name': 'Round 1', 'wt_protein': 'MK', 'wt_identifier': 'estA', 'host_organism': 'E. coli', 'n_variants': 2, 'top_fitness': 1.5, 'created_at': 'x', 'variants': [{'mutations': 'A1G'}], 'storage_path': 'libraries/secret.csv'}) r = client.get('/api/library/' + ART + '?project=' + PROJECT) assert r.status_code == 200 assert r.json['reopened'] is True and r.json['shared'] is True assert r.json['library_id'] == ART and r.json['variants'] == [{'mutations': 'A1G'}] assert 'secret' not in r.text
# ββ filing work into a project you edit ββββββββββββββββββββββββββββββββββ
def test_an_editors_save_is_filed_through_the_engine_only_function(monkeypatch): sent = [] monkeypatch.setattr(A, 'get_construct', lambda uid, cid: None) # not theirs monkeypatch.setattr(A, '_service_rpc', lambda fn, params, timeout=6.0: sent.append((fn, params)) or {'ok': True, 'role': 'edit'}) monkeypatch.setattr(A, 'update_construct', lambda *a, **k: pytest.fail('an editor never writes the owner row directly')) res = A.attach_artifact('editor-user', PROJECT, 'plasmid', ART) assert res == {'ok': True, 'role': 'edit'} assert sent == [('project_file_work', {'actor': 'editor-user', 'project': PROJECT, 'kind': 'plasmid', 'artifact': ART})]
def test_a_refused_filing_reads_as_before(monkeypatch): monkeypatch.setattr(A, 'get_construct', lambda uid, cid: None) monkeypatch.setattr(A, '_service_rpc', lambda fn, params, timeout=6.0: {'ok': False, 'status': 403}) assert A.attach_artifact('viewer-user', PROJECT, 'plasmid', ART) == {'ok': False, 'error': 'No such project.'}
def test_an_editors_library_is_filed_too(monkeypatch): sent = [] monkeypatch.setattr(A, 'get_construct', lambda uid, cid: None) monkeypatch.setattr(A, '_service_rpc', lambda fn, params, timeout=6.0: sent.append((fn, params)) or {'ok': True}) monkeypatch.setattr(A, 'record_edge', lambda *a, **k: None) A.attach_library('editor-user', PROJECT, ART.replace('-', '')) assert sent and sent[0][1]['kind'] == 'library' and sent[0][1]['artifact'] == ART
def test_the_owners_work_is_logged_after_it_is_linked(monkeypatch): logged = [] monkeypatch.setattr(A, 'get_construct', lambda uid, cid: {'id': cid, 'plasmid_ids': [], 'phase': 'Design'}) monkeypatch.setattr(A, 'update_construct', lambda *a, **k: {'ok': True}) monkeypatch.setattr(A, '_log_project_work_async', lambda *a: logged.append(a)) A.attach_artifact('owner-user', PROJECT, 'plasmid', ART) assert logged == [('owner-user', PROJECT, 'plasmid', ART)] # Already filed: nothing new happened, nothing is logged. logged.clear() monkeypatch.setattr(A, 'get_construct', lambda uid, cid: {'id': cid, 'plasmid_ids': [ART], 'phase': 'Build'}) A.attach_artifact('owner-user', PROJECT, 'plasmid', ART) assert logged == []
def test_a_failed_link_logs_nothing(monkeypatch): logged = [] monkeypatch.setattr(A, 'get_construct', lambda uid, cid: {'id': cid, 'plasmid_ids': [], 'phase': 'Design'}) monkeypatch.setattr(A, 'update_construct', lambda *a, **k: {'ok': False}) monkeypatch.setattr(A, '_log_project_work_async', lambda *a: logged.append(a)) A.attach_artifact('owner-user', PROJECT, 'plasmid', ART) assert logged == []
def test_filing_refuses_garbage_before_any_request(monkeypatch): monkeypatch.setattr(A, '_service_rpc', lambda *a, **k: pytest.fail('validated first')) assert A.file_project_work('u', 'not-a-uuid', 'plasmid', ART)['ok'] is False assert A.file_project_work('u', PROJECT, 'nonsense', ART)['ok'] is False assert A.file_project_work('', PROJECT, 'plasmid', ART)['ok'] is False assert A.file_project_work('u', PROJECT, 'plasmid', 'x')['ok'] is False
def test_the_engine_only_call_uses_the_service_key_and_never_the_users_jwt(monkeypatch): seen = {} monkeypatch.setattr(A, 'SUPABASE_URL', 'https://db.example') monkeypatch.setattr(A, 'SUPABASE_SERVICE_KEY', 'service-key')
class _Resp: def __enter__(self): return self def __exit__(self, *a): return False def read(self): return b'{"ok": true}'
def urlopen(req, timeout=None): seen['url'] = req.full_url seen['auth'] = req.get_header('Authorization') seen['body'] = json.loads(req.data.decode()) return _Resp() monkeypatch.setattr('urllib.request.urlopen', urlopen) assert A.file_project_work('owner-user', PROJECT, 'crispr', ART) == {'ok': True} assert seen['url'] == 'https://db.example/rest/v1/rpc/project_file_work' assert seen['auth'] == 'Bearer service-key' assert seen['body'] == {'actor': 'owner-user', 'project': PROJECT, 'kind': 'crispr', 'artifact': ART}
# ββ the shared bench's history βββββββββββββββββββββββββββββββββββββββββββ
def _bench_setup(monkeypatch, before): noted = [] monkeypatch.setattr(A, 'get_construct', lambda uid, cid: {'id': cid, 'meta': {'workspace': before}}) monkeypatch.setattr(A, 'update_construct', lambda *a, **k: {'ok': True}) monkeypatch.setattr(A, 'SUPABASE_URL', 'https://db.example') monkeypatch.setattr(A, 'SUPABASE_SERVICE_KEY', 'service-key') monkeypatch.setattr(A, 'note_project_bench', lambda *a: noted.append(a))
class _Now: def __init__(self, target, args, name, daemon): self.t, self.a = target, args def start(self): self.t(*self.a) monkeypatch.setattr(A.threading, 'Thread', _Now) return noted
def test_a_new_structure_on_the_bench_is_one_history_line(monkeypatch): noted = _bench_setup(monkeypatch, {'structure': {'acc': 'P0A7B8', 'src': 'tool'}}) A.save_workspace('owner-user', PROJECT, {'structure': {'acc': 'Q99ZW2', 'src': 'tool'}}) assert noted == [('owner-user', PROJECT, 'Q99ZW2', None)]
def test_redrawing_the_same_structure_is_not_a_change(monkeypatch): noted = _bench_setup(monkeypatch, {'structure': {'acc': 'P0A7B8', 'src': 'tool'}}) A.save_workspace('owner-user', PROJECT, {'structure': {'acc': 'P0A7B8', 'src': 'tool', 'at': 5}}) A.save_workspace('owner-user', PROJECT, {'run': 'run-abc'}) assert noted == []
def test_a_structure_guessed_from_the_gene_is_nobodys_choice(monkeypatch): noted = _bench_setup(monkeypatch, {}) A.save_workspace('owner-user', PROJECT, {'structure': {'acc': 'P0A7B8', 'src': 'gene'}}) assert noted == []
def test_a_complex_is_its_own_line(monkeypatch): noted = _bench_setup(monkeypatch, {'structure': {'acc': 'P0A7B8', 'src': 'tool'}}) A.save_workspace('owner-user', PROJECT, {'interaction': {'kind': 'experimental', 'pdb': {'pdb_id': '6VXX', 'assembly': '1'}}}) assert noted == [('owner-user', PROJECT, None, '6VXX')]
# ββ the client asks for all of it ββββββββββββββββββββββββββββββββββββββββ
def test_mission_control_paints_shared_with_me_cards(): js = _read('app.js') # The bug: decorateCollaboration only ran beside a non-empty portfolio, # and only ever MOVED cards the portfolio had painted. assert "if (!data.gated) { try { decorateCollaboration(); } catch (_) {} }" in js assert js.count('decorateCollaboration();') == 2, 'one call site on render, one on refresh' body = js[js.index('async function decorateCollaboration()'):js.index('function cardHtml(c)')] assert "p.role === 'owner'" in body and 'sharedCardHtml(p)' in body assert "shelf.querySelectorAll('.mc-cx[data-shared-in]').forEach((n) => n.remove());" in body, \ 'repainted from scratch, or a second pass shows each project twice' assert 'resolveMcThumbs(shelf)' in body, 'a shared card draws the same fold' # And the shelf follows an accept or a leave without a reload. assert 'window.TDMissionCollabRefresh' in js assert 'window.TDMissionCollabRefresh()' in _read('collab.js')
def test_every_tab_loader_names_the_project(): js = _read('app.js') for url in ("'/api/library/'", "'/api/crispr/designs/'", "'/api/primers/analyses/'", "'/api/plasmid/library/'"): assert re.search(r"fetch\(_viaProject\(" + re.escape(url) + r" \+ encodeURIComponent\(id\)\)\)", js), url pj = _read('project.js') assert 'via: via' in pj and "'project=' + encodeURIComponent(cid)" in pj # Parked (Mission Control): work opened from home is not the last project's. assert 'var cid = (!parked && current) ? constructIdOf(current) : null;' in pj
def test_the_shared_bench_wins_for_the_recipient_and_fills_its_tabs(): pj = _read('project.js') assert "!!(c.shared && c.shared.role !== 'owner')" in pj assert "patchRecord(key, { members: c.members });" in pj assert "emit('shared'" in pj
def test_the_bench_shows_the_history_and_the_invitation_says_what_accepting_means(): html = _read('index.html') assert 'id="benchShared"' in html assert re.search(r'<script src="/static/history\.js\?v=[^"]+" defer></script>', html) cj = _read('collab.js') assert 'what you save inside it is added to the project, under your name' in cj assert 'Your Turing conversations stay private.' in cj
@pytest.mark.skipif(shutil.which('node') is None, reason='node is not installed')def test_history_sentences_say_who_did_what(): """Run the real history.js in node and read its sentences back.""" script = r""" global.window = {}; global.document = {readyState: 'complete', addEventListener() {}, getElementById() { return null; }}; require(process.argv[1]); const H = window.TDHistory; const out = { save: H.sentence({kind: 'save', detail: {phase: 'Build', sequence: {dna_bp: 4107, protein_aa: 0}}}), rename: H.sentence({kind: 'save', detail: {name: '<b>x</b>'}}), plain: H.sentence({kind: 'save', detail: {}}), contribute: H.sentence({kind: 'contribute', detail: {kind: 'plasmid', name: 'pEST <v4>'}}), attach: H.sentence({kind: 'attach', detail: {kind: 'library', name: 'Round 2'}}), bench: H.sentence({kind: 'bench', detail: {structure: 'P0A7B8', complex: '6VXX'}}), accept: H.sentence({kind: 'invitation_accept', detail: {permission: 'edit'}}), invite: H.sentence({kind: 'invite', detail: {permission: 'read'}}), role: H.sentence({kind: 'role', detail: {member: 'Ada', permission: 'edit'}}), revoke: H.sentence({kind: 'revoke', detail: {}}), unknown: H.sentence({kind: 'something_new', detail: {evil: '<script>'}}), same: H.colour('Ada Lovelace') === H.colour('Ada Lovelace'), initials: H.initials('Ada Lovelace'), }; console.log(JSON.stringify(out)); """ proc = subprocess.run(['node', '-e', script, str(STATIC / 'history.js')], capture_output=True, text=True, timeout=30) assert proc.returncode == 0, proc.stderr out = json.loads(proc.stdout.strip().splitlines()[-1]) assert out['save'] == 'moved it to Build, edited the sequence (4,107 bp)' assert out['rename'] == 'renamed it β<b>x</b>β', 'names are escaped' assert out['plain'] == 'saved the project' assert out['contribute'] == 'added the plasmid <em>pEST <v4></em>' assert out['attach'] == 'added the variant library <em>Round 2</em>' assert out['bench'] == 'put structure <code>P0A7B8</code> on the bench and opened complex <code>6VXX</code>' assert out['accept'] == 'joined as Editor' assert out['invite'] == 'invited somebody as Viewer' assert out['role'] == 'made Ada Editor' assert out['revoke'] == 'withdrew an invitation' assert out['unknown'] == 'updated the project', 'an unknown change prints nothing it was sent' assert out['same'] is True assert out['initials'] == 'AL'dee/auth.py+126-4
dee/core/project_workspaces.py+107-43
dee/server.py+53
dee/static/app.js+89-10
dee/static/collab.css+92
dee/static/collab.js+11
dee/static/history.jsAdded+295
dee/static/index.html+44-39
dee/static/project.js+48-3
tests/test_shared_projects.pyAdded+441