Offer only the remote tokens within the asking agent's scope, so an agent kept to Europe is not offered Remote · United States
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5c3c187dca
commit
9e2631ffe3
3 files changed
+44
-9
No files matched your search
+9
-3
@@ -345,15 +345,21 @@ def suggest_places(
|
||||
regions, then towns, each by open roles (`places.suggest`, over every
|
||||
open role's place line and every open remote role's area). The count of
|
||||
`remote:any` is the remote roles in the scope of `agent`, the default
|
||||
agent when absent, as the feed counts them. An empty `q` suggests
|
||||
nothing."""
|
||||
agent when absent, as the feed counts them, and the other remote tokens
|
||||
are kept to that agent's scope, its `require` gates on country. An empty
|
||||
`q` suggests nothing."""
|
||||
if not places.fold(q):
|
||||
return []
|
||||
viewer = _agent_id(store, agent)
|
||||
gaz = store.gazetteer()
|
||||
found = store.agent(viewer) if viewer is not None else None
|
||||
scope = {p for g in (found.gates if found is not None else ())
|
||||
if g.field == "country" and g.mode == "require"
|
||||
for v in g.values for p in gaz.lookup(f"country:{v}") or ()}
|
||||
return [PlaceSuggestion(token=s.token, label=s.label, kind=s.kind, count=s.count)
|
||||
for s in places.suggest(
|
||||
q, store.open_places(), limit, remote=store.open_remote_areas(),
|
||||
gaz=store.gazetteer(),
|
||||
gaz=gaz, scope=scope,
|
||||
remote_any=lambda: store.count_roles(places=["remote:any"], agent=viewer,
|
||||
by_score=False))]
|
||||
|
||||
|
||||
Reference in new issue
Block a user