@codemem/server 0.31.3 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/static/app.js CHANGED
@@ -4122,6 +4122,7 @@
4122
4122
  groupPreferencesDrafts: /* @__PURE__ */ new Map(),
4123
4123
  groupScopeManagementOpen: /* @__PURE__ */ new Set(),
4124
4124
  groupScopeManagementDrafts: /* @__PURE__ */ new Map(),
4125
+ teamSetupGuide: null,
4125
4126
  availableProjects: []
4126
4127
  };
4127
4128
  //#endregion
@@ -7906,6 +7907,42 @@
7906
7907
  for (const [deviceId, name] of next.entries()) coordinatorAdminState.deviceRenameDrafts.set(deviceId, name);
7907
7908
  }
7908
7909
  //#endregion
7910
+ //#region src/tabs/coordinator-admin/data/team-card.ts
7911
+ function matchingSetupGuide(groupId, setupGuide) {
7912
+ if (!setupGuide) return null;
7913
+ return setupGuide.groupId === groupId ? setupGuide : null;
7914
+ }
7915
+ function defaultSpaceSummary(preferences, setupGuide) {
7916
+ if (preferences?.loaded && preferences.default_space_scope_id) return "Configured";
7917
+ if (preferences?.loaded) return "Not configured";
7918
+ if (setupGuide?.defaultSpaceLabel) return setupGuide.defaultSpaceLabel;
7919
+ if (setupGuide?.defaultSpaceScopeId) return "Configured";
7920
+ return "Open Team defaults to inspect";
7921
+ }
7922
+ function autoGrantSummary(preferences, setupGuide) {
7923
+ if (preferences?.loaded) return preferences.auto_grant_default_space_on_join ? "On for the default Space" : "Off — Space access stays explicit";
7924
+ if (setupGuide?.autoGrantDefaultSpaceOnJoin === true) return "On for the default Space";
7925
+ if (setupGuide?.autoGrantDefaultSpaceOnJoin === false) return "Off — Space access stays explicit";
7926
+ return "Open Team defaults to inspect";
7927
+ }
7928
+ function activeSpaceCount(scopeManagement) {
7929
+ if (!scopeManagement?.loaded) return null;
7930
+ return scopeManagement.scopes.filter((scope) => String(scope.status || "active") === "active").length;
7931
+ }
7932
+ function spacesSummary(scopeManagement) {
7933
+ const count = activeSpaceCount(scopeManagement);
7934
+ if (count === null) return "Open Spaces to inspect access grants";
7935
+ return `${count} active ${count === 1 ? "Space" : "Spaces"}`;
7936
+ }
7937
+ function teamCardOverview(opts) {
7938
+ const setupGuide = matchingSetupGuide(opts.groupId, opts.setupGuide);
7939
+ return {
7940
+ autoGrant: autoGrantSummary(opts.preferences, setupGuide),
7941
+ defaultSpace: defaultSpaceSummary(opts.preferences, setupGuide),
7942
+ spaces: spacesSummary(opts.scopeManagement)
7943
+ };
7944
+ }
7945
+ //#endregion
7909
7946
  //#region ../../node_modules/.pnpm/@radix-ui+react-dialog@1.1.15_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@radix-ui/react-dialog/dist/index.mjs
7910
7947
  var DIALOG_NAME = "Dialog";
7911
7948
  var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
@@ -10001,7 +10038,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10001
10038
  //#region src/tabs/coordinator-admin/data/scope-management.ts
10002
10039
  function scopeManagementReadinessMessage(summary) {
10003
10040
  if (summary.readiness === "ready") return null;
10004
- return "Sharing domain management needs the coordinator URL, target group, and admin secret before it can list scopes or change memberships.";
10041
+ return "Space management needs the coordinator URL, target Team, and admin secret before it can list Spaces or change memberships.";
10005
10042
  }
10006
10043
  function scopeStatusLabel(status) {
10007
10044
  const value = String(status || "active").trim();
@@ -10034,6 +10071,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10034
10071
  return statusRank[a.status] - statusRank[b.status] || a.displayName.localeCompare(b.displayName);
10035
10072
  });
10036
10073
  }
10074
+ function coordinatorAdminDevicesForGroup(loadedDevices, cachedDevices, groupId, devicesLoaded) {
10075
+ const targetGroupId = String(groupId || "").trim();
10076
+ if (devicesLoaded || loadedDevices.length > 0 || !targetGroupId) return loadedDevices;
10077
+ return cachedDevices.filter((device) => String(device.group_id || "").trim() === targetGroupId);
10078
+ }
10037
10079
  //#endregion
10038
10080
  //#region src/tabs/coordinator-admin/components/scope-management-panel.ts
10039
10081
  function emptyScopeDraft() {
@@ -10042,6 +10084,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10042
10084
  loading: false,
10043
10085
  error: "",
10044
10086
  includeInactive: false,
10087
+ devicesLoaded: false,
10045
10088
  scopes: [],
10046
10089
  membersByScope: /* @__PURE__ */ new Map(),
10047
10090
  devices: [],
@@ -10091,6 +10134,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10091
10134
  loading: false,
10092
10135
  error: "",
10093
10136
  includeInactive,
10137
+ devicesLoaded: true,
10094
10138
  scopes,
10095
10139
  devices,
10096
10140
  membersByScope: new Map(memberEntries.filter(([scopeId]) => scopeId.length > 0)),
@@ -10102,7 +10146,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10102
10146
  ...draftFor(groupId),
10103
10147
  loaded: true,
10104
10148
  loading: false,
10105
- error: error instanceof Error ? error.message : "Failed to load sharing domains."
10149
+ error: error instanceof Error ? error.message : "Failed to load Spaces."
10106
10150
  });
10107
10151
  }
10108
10152
  renderShell();
@@ -10125,7 +10169,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10125
10169
  const label = draft.createLabel.trim();
10126
10170
  const kind = draft.createKind.trim() || "team";
10127
10171
  if (!scopeId || !label) {
10128
- showGlobalNotice("Enter a scope id and label before creating a sharing domain.", "warning");
10172
+ showGlobalNotice("Enter a Space id and label before creating a Space.", "warning");
10129
10173
  return;
10130
10174
  }
10131
10175
  setDraft(groupId, {
@@ -10150,14 +10194,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10150
10194
  actionPendingKey: "",
10151
10195
  actionPendingKind: ""
10152
10196
  });
10153
- showGlobalNotice("Sharing domain created. Grant devices explicitly before data can sync.");
10197
+ showGlobalNotice("Space created. Grant devices explicitly before data can sync.");
10154
10198
  await loadGroupScopeManagement(groupId, renderShell, latest.includeInactive);
10155
10199
  } catch (error) {
10156
10200
  setDraft(groupId, {
10157
10201
  ...draftFor(groupId),
10158
10202
  actionPendingKey: "",
10159
10203
  actionPendingKind: "",
10160
- error: error instanceof Error ? error.message : "Failed to create sharing domain."
10204
+ error: error instanceof Error ? error.message : "Failed to create Space."
10161
10205
  });
10162
10206
  renderShell();
10163
10207
  }
@@ -10178,14 +10222,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10178
10222
  device_id: deviceId,
10179
10223
  role: "member"
10180
10224
  });
10181
- showGlobalNotice("Device granted access to the sharing domain.");
10225
+ showGlobalNotice("Device granted access to the Space.");
10182
10226
  await loadGroupScopeManagement(groupId, renderShell, draft.includeInactive);
10183
10227
  } catch (error) {
10184
10228
  setDraft(groupId, {
10185
10229
  ...draftFor(groupId),
10186
10230
  actionPendingKey: "",
10187
10231
  actionPendingKind: "",
10188
- error: error instanceof Error ? error.message : "Failed to grant scope membership."
10232
+ error: error instanceof Error ? error.message : "Failed to grant Space access."
10189
10233
  });
10190
10234
  renderShell();
10191
10235
  }
@@ -10195,7 +10239,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10195
10239
  if (!scopeId) return;
10196
10240
  if (!await openSyncConfirmDialog({
10197
10241
  title: `Revoke ${displayName || deviceId} from ${scope.label || scopeId}?`,
10198
- description: "Revocation only blocks future sync for this sharing domain. Data already copied to that device can remain there.",
10242
+ description: "Revocation only blocks future sync for this Space. Data already copied to that device can remain there.",
10199
10243
  confirmLabel: "Revoke membership",
10200
10244
  cancelLabel: "Keep membership",
10201
10245
  tone: "danger"
@@ -10212,22 +10256,22 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10212
10256
  renderShell();
10213
10257
  try {
10214
10258
  await revokeCoordinatorAdminScopeMember(groupId, scopeId, deviceId);
10215
- showGlobalNotice("Scope membership revoked. Future sync is blocked for that device.");
10259
+ showGlobalNotice("Space access revoked. Future sync is blocked for that device.");
10216
10260
  await loadGroupScopeManagement(groupId, renderShell, draft.includeInactive);
10217
10261
  } catch (error) {
10218
10262
  setDraft(groupId, {
10219
10263
  ...draftFor(groupId),
10220
10264
  actionPendingKey: "",
10221
10265
  actionPendingKind: "",
10222
- error: error instanceof Error ? error.message : "Failed to revoke scope membership."
10266
+ error: error instanceof Error ? error.message : "Failed to revoke Space access."
10223
10267
  });
10224
10268
  renderShell();
10225
10269
  }
10226
10270
  }
10227
10271
  function renderMembershipRows(groupId, scope, draft, ready, renderShell) {
10228
10272
  const scopeId = String(scope.scope_id || "").trim();
10229
- const rows = deriveScopeMembershipDeviceRows(draft.devices, draft.membersByScope.get(scopeId) ?? []);
10230
- if (!rows.length) return _$3("div", { class: "peer-submeta coordinator-admin-empty-state" }, "No enrolled devices in this group yet. Enroll a device before granting this sharing domain.");
10273
+ const rows = deriveScopeMembershipDeviceRows(coordinatorAdminDevicesForGroup(draft.devices, state.lastCoordinatorAdminDevices, groupId, draft.devicesLoaded), draft.membersByScope.get(scopeId) ?? []);
10274
+ if (!rows.length) return _$3("div", { class: "peer-submeta coordinator-admin-empty-state" }, "No enrolled devices in this Team yet. Enroll a device before granting this Space.");
10231
10275
  return _$3("div", { class: "coordinator-admin-scope-member-list" }, rows.map((row) => {
10232
10276
  const pendingKey = `${draft.actionPendingKind}:${scopeId}:${row.deviceId}`;
10233
10277
  const pending = draft.actionPendingKey === pendingKey;
@@ -10238,7 +10282,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10238
10282
  return _$3("div", {
10239
10283
  class: "coordinator-admin-scope-member-row",
10240
10284
  key: row.deviceId
10241
- }, _$3("div", { class: "coordinator-admin-scope-member-copy" }, _$3("strong", null, row.displayName), _$3("span", null, `${statusCopy} · ${row.role} · ${epochCopy}`), row.enabled ? null : _$3("span", null, "Device is disabled in this coordinator group.")), _$3("div", { class: "peer-actions" }, canGrant ? _$3("button", {
10285
+ }, _$3("div", { class: "coordinator-admin-scope-member-copy" }, _$3("strong", null, row.displayName), _$3("span", null, `${statusCopy} · ${row.role} · ${epochCopy}`), row.enabled ? null : _$3("span", null, "Device is disabled in this Team.")), _$3("div", { class: "peer-actions" }, canGrant ? _$3("button", {
10242
10286
  class: "settings-button",
10243
10287
  disabled: !ready || Boolean(draft.actionPendingKey),
10244
10288
  onClick: () => void grantMember(groupId, scopeId, row.deviceId, renderShell),
@@ -10253,11 +10297,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10253
10297
  }
10254
10298
  function renderScopeCard(groupId, scope, draft, ready, renderShell) {
10255
10299
  const scopeId = String(scope.scope_id || "").trim();
10256
- const label = String(scope.label || scopeId || "Untitled sharing domain");
10300
+ const label = String(scope.label || scopeId || "Untitled Space");
10257
10301
  return _$3("div", {
10258
10302
  class: "peer-card peer-card--padded coordinator-admin-scope-card",
10259
10303
  key: scopeId || label
10260
- }, _$3("div", { class: "peer-title" }, _$3("strong", null, label)), _$3("div", { class: "peer-meta" }, `Scope ID: ${scopeId || "unknown"}`), _$3("div", { class: "peer-submeta" }, `Kind: ${scope.kind || "user"} · Status: ${scopeStatusLabel(scope.status)} · Membership epoch: ${scope.membership_epoch ?? 0}`), _$3("div", { class: "peer-submeta" }, "Devices below are enrolled in the coordinator group; only active members can sync this sharing domain."), renderMembershipRows(groupId, scope, draft, ready, renderShell));
10304
+ }, _$3("div", { class: "peer-title" }, _$3("strong", null, label)), _$3("div", { class: "peer-submeta" }, `Status: ${scopeStatusLabel(scope.status)} · Kind: ${scope.kind || "user"}`), _$3("div", { class: "peer-meta" }, `Advanced: Space ID ${scopeId || "unknown"} · Membership epoch ${scope.membership_epoch ?? 0}`), _$3("div", { class: "peer-submeta" }, "Devices below are enrolled in the Team; only active Space members can sync this data boundary."), renderMembershipRows(groupId, scope, draft, ready, renderShell));
10261
10305
  }
10262
10306
  function renderGroupScopeManagementPanel(deps) {
10263
10307
  const { groupId, ready, summary, renderShell } = deps;
@@ -10265,12 +10309,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10265
10309
  if (!draft) return null;
10266
10310
  const readinessMessage = scopeManagementReadinessMessage(summary);
10267
10311
  if (readinessMessage) return _$3("div", { class: "peer-meta coordinator-admin-inline-warning" }, readinessMessage);
10268
- if (!draft.loaded) return _$3("div", { class: "peer-submeta" }, "Loading sharing domains…");
10312
+ if (!draft.loaded) return _$3("div", { class: "peer-submeta" }, "Loading Spaces…");
10269
10313
  const disabled = !ready || Boolean(draft.actionPendingKey) || draft.loading;
10270
- return _$3(k$3, null, _$3("h4", { class: "coordinator-admin-drawer-title" }, "Sharing domains"), _$3("div", { class: "peer-submeta" }, "Coordinator groups discover and enroll devices. Sharing domains grant data access. Granting a device here is explicit; group membership alone does not share memories."), _$3("label", { class: "coordinator-admin-inline-filter" }, _$3("span", {
10314
+ return _$3(k$3, null, _$3("h4", { class: "coordinator-admin-drawer-title" }, "Spaces"), _$3("div", { class: "peer-submeta" }, "Teams discover and enroll devices. Spaces grant data access. Granting a device here is explicit; Team membership alone does not share memories."), _$3("label", { class: "coordinator-admin-inline-filter" }, _$3("span", {
10271
10315
  class: "section-meta",
10272
10316
  id: `coord-admin-domain-inactive-${groupId}`
10273
- }, "Show inactive domains"), _$3(RadixSwitch, {
10317
+ }, "Show inactive Spaces"), _$3(RadixSwitch, {
10274
10318
  "aria-labelledby": `coord-admin-domain-inactive-${groupId}`,
10275
10319
  checked: draft.includeInactive,
10276
10320
  className: "coordinator-admin-switch",
@@ -10279,7 +10323,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10279
10323
  loadGroupScopeManagement(groupId, renderShell, checked);
10280
10324
  },
10281
10325
  thumbClassName: "coordinator-admin-switch-thumb"
10282
- })), _$3("div", { class: "coordinator-admin-form-grid" }, _$3("label", { class: "coordinator-admin-field" }, _$3("span", null, "New domain id"), _$3(TextInput, {
10326
+ })), _$3("div", { class: "coordinator-admin-form-grid" }, _$3("label", { class: "coordinator-admin-field" }, _$3("span", null, "New Space id"), _$3(TextInput, {
10283
10327
  class: "peer-scope-input",
10284
10328
  disabled,
10285
10329
  onInput: (event) => {
@@ -10320,12 +10364,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10320
10364
  disabled,
10321
10365
  onClick: () => void createScope(groupId, renderShell),
10322
10366
  type: "button"
10323
- }, draft.actionPendingKind === "create" ? "Creating…" : "Create sharing domain"), _$3("button", {
10367
+ }, draft.actionPendingKind === "create" ? "Creating…" : "Create Space"), _$3("button", {
10324
10368
  class: "settings-button",
10325
10369
  disabled,
10326
10370
  onClick: () => void loadGroupScopeManagement(groupId, renderShell, draft.includeInactive),
10327
10371
  type: "button"
10328
- }, draft.loading ? "Refreshing…" : "Refresh")), draft.error ? _$3("div", { class: "peer-submeta coordinator-admin-error" }, draft.error) : null, draft.scopes.length ? _$3("div", { class: "coordinator-admin-scope-card-list" }, draft.scopes.map((scope) => renderScopeCard(groupId, scope, draft, ready, renderShell))) : _$3("div", { class: "peer-meta coordinator-admin-empty-state" }, "No sharing domains are defined for this group yet. Create one, then grant specific devices."));
10372
+ }, draft.loading ? "Refreshing…" : "Refresh")), draft.error ? _$3("div", { class: "peer-submeta coordinator-admin-error" }, draft.error) : null, draft.scopes.length ? _$3("div", { class: "coordinator-admin-scope-card-list" }, draft.scopes.map((scope) => renderScopeCard(groupId, scope, draft, ready, renderShell))) : _$3("div", { class: "peer-meta coordinator-admin-empty-state" }, "No Spaces are defined for this Team yet. Create a Space, then grant specific devices. Projects stay local-only until assigned to a Space."));
10329
10373
  }
10330
10374
  //#endregion
10331
10375
  //#region src/tabs/coordinator-admin/components/groups-panel.ts
@@ -10346,6 +10390,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10346
10390
  projects_include: [],
10347
10391
  projects_exclude: [],
10348
10392
  auto_seed_scope: true,
10393
+ default_space_scope_id: "",
10394
+ auto_grant_default_space_on_join: false,
10349
10395
  loaded: false,
10350
10396
  saving: false,
10351
10397
  error: ""
@@ -10362,6 +10408,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10362
10408
  projects_include: Array.isArray(prefs.projects_include) ? [...prefs.projects_include] : [],
10363
10409
  projects_exclude: Array.isArray(prefs.projects_exclude) ? [...prefs.projects_exclude] : [],
10364
10410
  auto_seed_scope: prefs.auto_seed_scope,
10411
+ default_space_scope_id: prefs.default_space_scope_id || "",
10412
+ auto_grant_default_space_on_join: prefs.auto_grant_default_space_on_join === true,
10365
10413
  loaded: true,
10366
10414
  saving: false,
10367
10415
  error: ""
@@ -10387,7 +10435,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10387
10435
  const payload = {
10388
10436
  projects_include: initial.projects_include.length > 0 ? [...initial.projects_include] : null,
10389
10437
  projects_exclude: initial.projects_exclude.length > 0 ? [...initial.projects_exclude] : null,
10390
- auto_seed_scope: initial.auto_seed_scope
10438
+ auto_seed_scope: initial.auto_seed_scope,
10439
+ default_space_scope_id: initial.default_space_scope_id || null,
10440
+ auto_grant_default_space_on_join: initial.auto_grant_default_space_on_join
10391
10441
  };
10392
10442
  coordinatorAdminState.groupPreferencesDrafts.set(groupId, {
10393
10443
  ...initial,
@@ -10397,7 +10447,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10397
10447
  renderShell();
10398
10448
  try {
10399
10449
  await saveCoordinatorGroupPreferences(groupId, payload);
10400
- showGlobalNotice("Group project defaults saved. New peers enrolled through this team will use these filters.");
10450
+ showGlobalNotice("Team defaults saved. New devices use these filters and Space settings.");
10401
10451
  closeGroupPreferences(groupId, renderShell);
10402
10452
  } catch (error) {
10403
10453
  const latest = coordinatorAdminState.groupPreferencesDrafts.get(groupId);
@@ -10415,10 +10465,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10415
10465
  if (!draft) return null;
10416
10466
  if (!draft.loaded) return _$3("div", { class: "peer-submeta" }, "Loading project defaults…");
10417
10467
  const autoSeedLabelId = `coord-admin-scope-autoseed-${groupId}`;
10468
+ const autoGrantLabelId = `coord-admin-default-space-autogrant-${groupId}`;
10418
10469
  const includeLabelId = `coord-admin-scope-include-${groupId}`;
10419
10470
  const excludeLabelId = `coord-admin-scope-exclude-${groupId}`;
10420
10471
  const fieldsDisabled = !ready || draft.saving || !draft.auto_seed_scope;
10421
- return _$3(k$3, null, _$3("h4", { class: "coordinator-admin-drawer-title" }, "Project defaults"), _$3("div", { class: "peer-submeta" }, "When enabled, new peers enrolled through this coordinator group start with the project filters below. Existing peers are unchanged, and these filters never grant sharing-domain access."), _$3("label", { class: "coordinator-admin-inline-filter" }, _$3("span", {
10472
+ return _$3(k$3, null, _$3("h4", { class: "coordinator-admin-drawer-title" }, "Team defaults"), _$3("div", { class: "peer-submeta" }, "Project filters only narrow what future writes sync; they never grant Space access by themselves. Use the default Space toggle to control whether newly joined devices receive the Team's default Space."), _$3("label", { class: "coordinator-admin-inline-filter" }, _$3("span", {
10422
10473
  class: "section-meta",
10423
10474
  id: autoSeedLabelId
10424
10475
  }, "Auto-seed project filters"), _$3(RadixSwitch, {
@@ -10435,7 +10486,24 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10435
10486
  renderShell();
10436
10487
  },
10437
10488
  thumbClassName: "coordinator-admin-switch-thumb"
10438
- })), _$3("div", { class: "coordinator-admin-field" }, _$3("span", { id: includeLabelId }, "Include projects"), _$3(ProjectScopePicker, {
10489
+ })), _$3("label", { class: "coordinator-admin-inline-filter" }, _$3("span", {
10490
+ class: "section-meta",
10491
+ id: autoGrantLabelId
10492
+ }, "Auto-grant default Space on join"), _$3(RadixSwitch, {
10493
+ "aria-labelledby": autoGrantLabelId,
10494
+ checked: draft.auto_grant_default_space_on_join,
10495
+ className: "coordinator-admin-switch",
10496
+ disabled: !ready || draft.saving || !draft.default_space_scope_id,
10497
+ onCheckedChange: (checked) => {
10498
+ const current = coordinatorAdminState.groupPreferencesDrafts.get(groupId) ?? draft;
10499
+ coordinatorAdminState.groupPreferencesDrafts.set(groupId, {
10500
+ ...current,
10501
+ auto_grant_default_space_on_join: checked
10502
+ });
10503
+ renderShell();
10504
+ },
10505
+ thumbClassName: "coordinator-admin-switch-thumb"
10506
+ })), draft.default_space_scope_id ? _$3("div", { class: "peer-submeta" }, "Default Space configured.") : _$3("div", { class: "peer-submeta" }, "No default Space has been created yet."), _$3("div", { class: "coordinator-admin-field" }, _$3("span", { id: includeLabelId }, "Include projects"), _$3(ProjectScopePicker, {
10439
10507
  "aria-labelledby": includeLabelId,
10440
10508
  availableProjects: coordinatorAdminState.availableProjects,
10441
10509
  disabled: fieldsDisabled,
@@ -10477,6 +10545,54 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10477
10545
  type: "button"
10478
10546
  }, "Cancel")));
10479
10547
  }
10548
+ function renderTeamSetupGuide(renderShell) {
10549
+ const guide = coordinatorAdminState.teamSetupGuide;
10550
+ if (!guide) return null;
10551
+ const title = guide.displayName || guide.groupId;
10552
+ const warningStep = {
10553
+ default_space: "default Space setup",
10554
+ default_space_grant: "default Space access grant"
10555
+ }[guide.setupWarning?.step || ""] || "default Space setup";
10556
+ return _$3("div", { class: "peer-meta coordinator-admin-empty-state" }, _$3("h4", { class: "coordinator-admin-drawer-title" }, `Set up ${title}`), _$3("div", { class: "peer-submeta" }, "A Team organizes people and devices. The default Space is the memory boundary; Team membership only grants data access when default Space auto-grant is enabled."), guide.setupWarning ? _$3("div", { class: "peer-meta coordinator-admin-inline-warning" }, `Team created, but ${warningStep} failed. Automatic repair is not available yet; use Spaces to inspect or create access manually before inviting teammates.`) : _$3("div", { class: "peer-submeta" }, guide.defaultSpaceScopeId ? guide.defaultSpaceLabel ? `Default Space ready: ${guide.defaultSpaceLabel}. New devices can receive this Space when auto-grant is enabled.` : "Default Space ready. New devices can receive this Space when auto-grant is enabled." : "Default Space status is unknown. Check Spaces before inviting teammates."), _$3("ol", { class: "peer-submeta" }, _$3("li", null, "Review Team defaults and the auto-grant default Space setting."), _$3("li", null, "Invite teammates or other devices."), _$3("li", null, "Assign projects to Spaces from the Projects tab.")), _$3("div", { class: "peer-actions" }, _$3("button", {
10557
+ class: "settings-button",
10558
+ onClick: () => {
10559
+ coordinatorAdminState.groupPreferencesOpen.add(guide.groupId);
10560
+ openGroupPreferences(guide.groupId, renderShell);
10561
+ },
10562
+ type: "button"
10563
+ }, "Review Team defaults"), _$3("button", {
10564
+ class: "settings-button",
10565
+ onClick: () => {
10566
+ openGroupScopeManagement(guide.groupId, renderShell);
10567
+ },
10568
+ type: "button"
10569
+ }, "Check Spaces"), _$3("button", {
10570
+ class: "settings-button",
10571
+ onClick: () => {
10572
+ coordinatorAdminState.inviteGroup = guide.groupId;
10573
+ coordinatorAdminState.activeSection = "invites";
10574
+ renderShell();
10575
+ },
10576
+ type: "button"
10577
+ }, "Invite devices"), _$3("button", {
10578
+ class: "settings-button",
10579
+ onClick: () => {
10580
+ window.location.hash = "projects";
10581
+ },
10582
+ type: "button"
10583
+ }, "Assign projects"), _$3("button", {
10584
+ class: "settings-button",
10585
+ onClick: () => {
10586
+ coordinatorAdminState.teamSetupGuide = null;
10587
+ renderShell();
10588
+ },
10589
+ type: "button"
10590
+ }, "Dismiss")));
10591
+ }
10592
+ function archiveButtonLabel(archived, pending) {
10593
+ if (pending) return archived ? "Restoring…" : "Archiving…";
10594
+ return archived ? "Unarchive" : "Archive";
10595
+ }
10480
10596
  function renderGroupsPanel(deps) {
10481
10597
  const { summary, createGroup, runGroup, renderShell, reloadData } = deps;
10482
10598
  const configuredGroup = String(state.lastCoordinatorAdminStatus?.active_group || "").trim();
@@ -10491,7 +10607,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10491
10607
  return _$3(RadixTabsContent, {
10492
10608
  className: "coordinator-admin-panel",
10493
10609
  value: "groups"
10494
- }, _$3("h3", null, "Groups"), _$3("p", { class: "peer-submeta" }, selectedGroup ? `Managing ${selectedGroup}${configuredGroup && configuredGroup !== selectedGroup ? ` · this node uses ${configuredGroup} for discovery` : ""}` : configuredGroup ? `This node uses ${configuredGroup} for discovery. Select a group below to manage it.` : "No group selected yet. Create one or select an existing group to manage."), groups.length ? _$3("p", { class: "peer-submeta" }, countParts.join(" · ")) : null, !targetExists && selectedGroup ? _$3("div", { class: "peer-meta coordinator-admin-inline-warning" }, `The selected admin target group (${selectedGroup}) is configured locally but does not exist in the coordinator yet. Create it below or switch to another group once one exists.`) : null, _$3("div", { class: "coordinator-admin-form-grid" }, _$3("label", { class: "coordinator-admin-field" }, _$3("span", null, "New group id"), _$3(TextInput, {
10610
+ }, _$3("h3", null, "Teams"), _$3("p", { class: "peer-submeta" }, selectedGroup ? `Managing ${selectedGroup}${configuredGroup && configuredGroup !== selectedGroup ? ` · this node uses ${configuredGroup} for discovery` : ""}` : configuredGroup ? `This node uses ${configuredGroup} for discovery. Select a Team below to manage it.` : "No Team selected yet. Create one or select an existing Team to manage."), groups.length ? _$3("p", { class: "peer-submeta" }, countParts.join(" · ")) : null, !targetExists && selectedGroup ? _$3("div", { class: "peer-meta coordinator-admin-inline-warning" }, `The selected Team (${selectedGroup}) is configured locally but does not exist in the coordinator yet. Create it below or switch to another Team once one exists.`) : null, renderTeamSetupGuide(renderShell), _$3("div", { class: "coordinator-admin-form-grid" }, _$3("label", { class: "coordinator-admin-field" }, _$3("span", null, "New Team id"), _$3(TextInput, {
10495
10611
  class: "peer-scope-input",
10496
10612
  disabled: summary.readiness !== "ready" || coordinatorAdminState.groupActionPendingKind === "create",
10497
10613
  onInput: (event) => {
@@ -10514,7 +10630,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10514
10630
  disabled: summary.readiness !== "ready" || coordinatorAdminState.groupActionPendingKind === "create",
10515
10631
  onClick: () => createGroup(),
10516
10632
  type: "button"
10517
- }, coordinatorAdminState.groupActionPendingKind === "create" ? "Creating…" : "Create group")), _$3("div", { class: "coordinator-admin-secondary-actions" }, _$3("label", { class: "coordinator-admin-inline-filter" }, _$3("span", {
10633
+ }, coordinatorAdminState.groupActionPendingKind === "create" ? "Creating…" : "Create Team")), _$3("div", { class: "coordinator-admin-secondary-actions" }, _$3("label", { class: "coordinator-admin-inline-filter" }, _$3("span", {
10518
10634
  class: "section-meta",
10519
10635
  id: "coordinatorAdminShowArchivedLabel"
10520
10636
  }, "Show archived"), _$3(RadixSwitch, {
@@ -10527,17 +10643,25 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10527
10643
  renderShell();
10528
10644
  },
10529
10645
  thumbClassName: "coordinator-admin-switch-thumb"
10530
- })))), !visibleGroups.length ? _$3("div", { class: "peer-meta coordinator-admin-empty-state" }, summary.readiness === "ready" ? coordinatorAdminState.showArchivedGroups ? "No coordinator groups are available yet." : "No active groups yet. Create one to get started." : "Group browsing will appear here once setup is complete.") : _$3("div", { class: "peer-list" }, visibleGroups.map((group) => {
10646
+ })))), !visibleGroups.length ? _$3("div", { class: "peer-meta coordinator-admin-empty-state" }, summary.readiness === "ready" ? coordinatorAdminState.showArchivedGroups ? "No Teams are available yet." : "No active Teams yet. Create one to get started." : "Team browsing will appear here once setup is complete.") : _$3("div", { class: "peer-list" }, visibleGroups.map((group) => {
10531
10647
  const selected = group.group_id === selectedGroup;
10532
10648
  const pending = coordinatorAdminState.groupActionPendingId === group.group_id;
10533
10649
  const archived = Boolean(group.archived_at);
10534
10650
  const draftName = coordinatorAdminState.groupRenameDrafts.get(group.group_id) ?? group.display_name ?? group.group_id;
10535
10651
  const scopeOpen = coordinatorAdminState.groupPreferencesOpen.has(group.group_id);
10536
10652
  const domainsOpen = coordinatorAdminState.groupScopeManagementOpen.has(group.group_id);
10653
+ const archiveActionKind = archived ? "unarchive" : "archive";
10654
+ const archiveActionLabel = archiveButtonLabel(archived, pending && coordinatorAdminState.groupActionPendingKind === archiveActionKind);
10655
+ const overview = teamCardOverview({
10656
+ groupId: group.group_id,
10657
+ preferences: coordinatorAdminState.groupPreferencesDrafts.get(group.group_id),
10658
+ scopeManagement: coordinatorAdminState.groupScopeManagementDrafts.get(group.group_id),
10659
+ setupGuide: coordinatorAdminState.teamSetupGuide
10660
+ });
10537
10661
  return _$3("div", {
10538
10662
  class: "peer-card peer-card--padded",
10539
10663
  key: group.group_id
10540
- }, _$3("div", { class: "peer-title" }, _$3("strong", null, draftName)), _$3("div", { class: "peer-meta" }, `Group ID: ${group.group_id}`), _$3("div", { class: "peer-submeta" }, archived ? "Archived" : "Active"), configuredGroup === group.group_id ? _$3("div", { class: "peer-submeta" }, "This node is configured to use this group for coordinator-backed discovery.") : null, _$3("label", { class: "coordinator-admin-field" }, _$3("span", null, "Display name"), _$3(TextInput, {
10664
+ }, _$3("div", { class: "peer-title" }, _$3("strong", null, draftName)), _$3("div", { class: "peer-submeta" }, archived ? "Archived Team" : "Active Team"), _$3("div", { class: "peer-meta" }, `Advanced: Team ID ${group.group_id}`), _$3("div", { class: "coordinator-admin-summary-grid" }, _$3("div", { class: "coordinator-admin-summary-card" }, _$3("span", { class: "section-meta" }, "Default Space"), _$3("strong", null, overview.defaultSpace)), _$3("div", { class: "coordinator-admin-summary-card" }, _$3("span", { class: "section-meta" }, "Auto-grant"), _$3("strong", null, overview.autoGrant)), _$3("div", { class: "coordinator-admin-summary-card" }, _$3("span", { class: "section-meta" }, "Spaces"), _$3("strong", null, overview.spaces))), configuredGroup === group.group_id ? _$3("div", { class: "peer-submeta" }, "This node uses this Team for coordinator-backed discovery.") : null, _$3("label", { class: "coordinator-admin-field" }, _$3("span", null, "Display name"), _$3(TextInput, {
10541
10665
  class: "peer-scope-input",
10542
10666
  disabled: summary.readiness !== "ready" || pending,
10543
10667
  onInput: (event) => {
@@ -10553,7 +10677,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10553
10677
  reloadData();
10554
10678
  },
10555
10679
  type: "button"
10556
- }, selected ? "Managing" : "Manage"), _$3("button", {
10680
+ }, selected ? "Managing" : "Manage Team"), _$3("button", {
10557
10681
  class: "settings-button",
10558
10682
  disabled: summary.readiness !== "ready" || pending,
10559
10683
  onClick: () => runGroup(group.group_id, draftName, "rename"),
@@ -10569,12 +10693,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10569
10693
  else openGroupPreferences(group.group_id, renderShell);
10570
10694
  },
10571
10695
  type: "button"
10572
- }, _$3("span", null, "Project defaults"), _$3("span", {
10696
+ }, _$3("span", null, "Team defaults"), _$3("span", {
10573
10697
  "aria-hidden": "true",
10574
10698
  class: "device-row-chevron"
10575
10699
  }, _$3(ChevronRightIcon$1, null))), _$3("button", {
10576
10700
  "aria-expanded": domainsOpen,
10577
- "aria-controls": `coord-admin-domains-drawer-${group.group_id}`,
10701
+ "aria-controls": `coord-admin-spaces-drawer-${group.group_id}`,
10578
10702
  class: "settings-button coordinator-admin-scope-trigger",
10579
10703
  "data-state": domainsOpen ? "open" : "closed",
10580
10704
  disabled: summary.readiness !== "ready" || pending,
@@ -10583,15 +10707,15 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10583
10707
  else openGroupScopeManagement(group.group_id, renderShell);
10584
10708
  },
10585
10709
  type: "button"
10586
- }, _$3("span", null, "Sharing domains"), _$3("span", {
10710
+ }, _$3("span", null, "Spaces & access"), _$3("span", {
10587
10711
  "aria-hidden": "true",
10588
10712
  class: "device-row-chevron"
10589
10713
  }, _$3(ChevronRightIcon$1, null))), _$3("button", {
10590
10714
  class: archived ? "settings-button" : "settings-button danger",
10591
10715
  disabled: summary.readiness !== "ready" || pending,
10592
- onClick: () => runGroup(group.group_id, group.display_name || group.group_id, archived ? "unarchive" : "archive"),
10716
+ onClick: () => runGroup(group.group_id, group.display_name || group.group_id, archiveActionKind),
10593
10717
  type: "button"
10594
- }, pending && coordinatorAdminState.groupActionPendingKind === (archived ? "unarchive" : "archive") ? archived ? "Restoring…" : "Archiving…" : archived ? "Unarchive" : "Archive")), _$3(Root$3, {
10718
+ }, archiveActionLabel)), _$3(Root$3, {
10595
10719
  open: scopeOpen,
10596
10720
  onOpenChange: (open) => {
10597
10721
  if (open) openGroupPreferences(group.group_id, renderShell);
@@ -10608,9 +10732,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10608
10732
  else closeGroupScopeManagement(group.group_id, renderShell);
10609
10733
  }
10610
10734
  }, _$3(Content$2, {
10611
- "aria-label": `Sharing domains for ${draftName}`,
10735
+ "aria-label": `Spaces for ${draftName}`,
10612
10736
  class: "coordinator-admin-group-preferences coordinator-admin-domain-management",
10613
- id: `coord-admin-domains-drawer-${group.group_id}`
10737
+ id: `coord-admin-spaces-drawer-${group.group_id}`
10614
10738
  }, domainsOpen ? renderGroupScopeManagementPanel({
10615
10739
  groupId: group.group_id,
10616
10740
  ready: summary.readiness === "ready",
@@ -10636,11 +10760,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10636
10760
  return _$3(RadixTabsContent, {
10637
10761
  className: "coordinator-admin-panel",
10638
10762
  value: "invites"
10639
- }, _$3("h3", null, "Create teammate invite"), _$3("p", { class: "peer-submeta" }, summary.readiness === "ready" ? "Generate a coordinator-backed invite from the same operator surface that will later handle join requests and device administration." : "Finish setup first. Invite creation stays disabled until the local coordinator admin configuration is ready."), _$3("div", { class: "coordinator-admin-form-grid" }, _$3("label", { class: "coordinator-admin-field" }, _$3("span", null, "Group"), _$3(TextInput, {
10763
+ }, _$3("h3", null, "Create teammate invite"), _$3("p", { class: "peer-submeta" }, summary.readiness === "ready" ? "Generate an invite for the selected Team. Default Space access is controlled by that Team's auto-grant setting." : "Finish setup first. Invite creation stays disabled until the local coordinator admin configuration is ready."), _$3("div", { class: "coordinator-admin-form-grid" }, _$3("label", { class: "coordinator-admin-field" }, _$3("span", null, "Team"), _$3(TextInput, {
10640
10764
  class: "peer-scope-input",
10641
10765
  disabled: summary.readiness !== "ready",
10642
10766
  onInput: (event) => {
10643
10767
  coordinatorAdminState.inviteGroup = String(event.currentTarget.value || "");
10768
+ renderShell();
10644
10769
  },
10645
10770
  placeholder: activeGroup || "team-alpha",
10646
10771
  type: "text",
@@ -10657,10 +10782,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10657
10782
  },
10658
10783
  options: [{
10659
10784
  value: "auto_admit",
10660
- label: "Auto-admit"
10785
+ label: "Auto-admit to Team"
10661
10786
  }, {
10662
10787
  value: "approval_required",
10663
- label: "Approval required"
10788
+ label: "Require approval to join Team"
10664
10789
  }],
10665
10790
  triggerClassName: "sync-radix-select-trigger sync-actor-select",
10666
10791
  value: coordinatorAdminState.invitePolicy,
@@ -10681,7 +10806,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10681
10806
  createInvite();
10682
10807
  },
10683
10808
  type: "button"
10684
- }, coordinatorAdminState.invitePending ? "Creating…" : "Create invite"), effectiveGroup ? _$3("span", { class: "peer-submeta" }, `Using group ${effectiveGroup}`) : null), output ? _$3("label", { class: "coordinator-admin-field" }, _$3("span", null, "Generated invite"), _$3(TextArea, {
10809
+ }, coordinatorAdminState.invitePending ? "Creating…" : "Create invite"), effectiveGroup ? _$3("span", { class: "peer-submeta" }, `Using Team ${effectiveGroup}`) : null), output ? _$3("label", { class: "coordinator-admin-field" }, _$3("span", null, "Generated invite"), _$3(TextArea, {
10685
10810
  class: "feed-search coordinator-admin-output",
10686
10811
  readOnly: true,
10687
10812
  value: output
@@ -10728,22 +10853,39 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10728
10853
  if (coordinatorAdminState.groupActionPendingKind) return;
10729
10854
  const groupId = coordinatorAdminState.createGroupId.trim();
10730
10855
  if (!groupId) {
10731
- showGlobalNotice("Enter a group id before creating a group.", "warning");
10856
+ showGlobalNotice("Enter a Team id before creating a Team.", "warning");
10732
10857
  return;
10733
10858
  }
10859
+ const requestedDisplayName = coordinatorAdminState.createGroupDisplayName.trim();
10734
10860
  coordinatorAdminState.groupActionPendingKind = "create";
10735
10861
  renderShell();
10736
10862
  try {
10737
- await createCoordinatorAdminGroup({
10863
+ const result = await createCoordinatorAdminGroup({
10738
10864
  group_id: groupId,
10739
- display_name: coordinatorAdminState.createGroupDisplayName.trim() || null
10865
+ display_name: requestedDisplayName || null
10740
10866
  });
10867
+ const defaultSpaceContainer = result.default_space;
10868
+ const defaultSpace = (defaultSpaceContainer && "scope" in defaultSpaceContainer ? defaultSpaceContainer.scope : defaultSpaceContainer) ?? {};
10869
+ const defaultSpacePreferences = defaultSpaceContainer && "preferences" in defaultSpaceContainer ? defaultSpaceContainer.preferences : null;
10870
+ const defaultSpaceScopeId = String(defaultSpace?.scope_id || "");
10741
10871
  coordinatorAdminState.createGroupId = "";
10742
10872
  coordinatorAdminState.createGroupDisplayName = "";
10743
- showGlobalNotice("Group created.", "success");
10873
+ coordinatorAdminState.teamSetupGuide = {
10874
+ groupId,
10875
+ displayName: String(result.group?.display_name || requestedDisplayName || groupId),
10876
+ defaultSpaceScopeId,
10877
+ defaultSpaceLabel: String(defaultSpace?.label || ""),
10878
+ autoGrantDefaultSpaceOnJoin: typeof defaultSpacePreferences?.auto_grant_default_space_on_join === "boolean" ? defaultSpacePreferences.auto_grant_default_space_on_join : null,
10879
+ setupWarning: result.setup_warning || null
10880
+ };
10744
10881
  await reloadData();
10882
+ setAdminTargetGroup(groupId);
10883
+ await reloadData();
10884
+ if (result.setup_warning) showGlobalNotice("Team created, but default Space setup needs repair.", "warning");
10885
+ else if (defaultSpaceScopeId) showGlobalNotice("Team created with a default Space.", "success");
10886
+ else showGlobalNotice("Team created, but default Space status is unknown.", "warning");
10745
10887
  } catch (error) {
10746
- showGlobalNotice(error instanceof Error ? error.message : "Failed to create group.", "warning");
10888
+ showGlobalNotice(error instanceof Error ? error.message : "Failed to create Team.", "warning");
10747
10889
  } finally {
10748
10890
  coordinatorAdminState.groupActionPendingKind = "";
10749
10891
  renderShell();
@@ -10753,9 +10895,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10753
10895
  if (!groupId || coordinatorAdminState.groupActionPendingId) return;
10754
10896
  if ((kind === "archive" || kind === "unarchive") && !await openSyncConfirmDialog({
10755
10897
  title: `${kind === "archive" ? "Archive" : "Unarchive"} ${displayName || groupId}?`,
10756
- description: kind === "archive" ? "Archived groups stay visible and restorable, but they stop being operational for new invites and joins." : "This group will become operational again for invites and coordinator-backed joins.",
10757
- confirmLabel: kind === "archive" ? "Archive group" : "Unarchive group",
10758
- cancelLabel: kind === "archive" ? "Keep group active" : "Keep group archived",
10898
+ description: kind === "archive" ? "Archived Teams stay visible and restorable, but they stop being operational for new invites and joins." : "This Team will become operational again for invites and coordinator-backed joins.",
10899
+ confirmLabel: kind === "archive" ? "Archive Team" : "Unarchive Team",
10900
+ cancelLabel: kind === "archive" ? "Keep Team active" : "Keep Team archived",
10759
10901
  tone: "danger"
10760
10902
  })) return;
10761
10903
  coordinatorAdminState.groupActionPendingId = groupId;
@@ -10764,19 +10906,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10764
10906
  try {
10765
10907
  if (kind === "rename") {
10766
10908
  await renameCoordinatorAdminGroup(groupId, displayName);
10767
- showGlobalNotice("Group renamed.", "success");
10909
+ showGlobalNotice("Team renamed.", "success");
10768
10910
  }
10769
10911
  if (kind === "archive") {
10770
10912
  await archiveCoordinatorAdminGroup(groupId);
10771
- showGlobalNotice("Group archived.", "success");
10913
+ showGlobalNotice("Team archived.", "success");
10772
10914
  }
10773
10915
  if (kind === "unarchive") {
10774
10916
  await unarchiveCoordinatorAdminGroup(groupId);
10775
- showGlobalNotice("Group unarchived.", "success");
10917
+ showGlobalNotice("Team unarchived.", "success");
10776
10918
  }
10777
10919
  await reloadData();
10778
10920
  } catch (error) {
10779
- showGlobalNotice(error instanceof Error ? error.message : `Failed to ${kind} group.`, "warning");
10921
+ showGlobalNotice(error instanceof Error ? error.message : `Failed to ${kind} Team.`, "warning");
10780
10922
  } finally {
10781
10923
  coordinatorAdminState.groupActionPendingId = "";
10782
10924
  coordinatorAdminState.groupActionPendingKind = "";
@@ -10790,7 +10932,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10790
10932
  const groupId = coordinatorAdminState.inviteGroup.trim() || defaultGroup;
10791
10933
  const ttlHours = Number(coordinatorAdminState.inviteTtlHours);
10792
10934
  if (!groupId) {
10793
- showGlobalNotice("Choose a coordinator group before creating an invite.", "warning");
10935
+ showGlobalNotice("Choose a Team before creating an invite.", "warning");
10794
10936
  return;
10795
10937
  }
10796
10938
  if (!Number.isFinite(ttlHours) || ttlHours < 1) {
@@ -10822,8 +10964,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10822
10964
  coordinatorAdminState.joinReviewPendingAction = action;
10823
10965
  renderShell();
10824
10966
  try {
10825
- await reviewCoordinatorAdminJoinRequest(requestId, action);
10826
- showGlobalNotice(action === "approve" ? "Join request approved." : "Join request denied.", "success");
10967
+ const result = await reviewCoordinatorAdminJoinRequest(requestId, action);
10968
+ if (action === "approve" && result.setup_warning) showGlobalNotice("Join request approved, but default Space access needs repair.", "warning");
10969
+ else showGlobalNotice(action === "approve" ? "Join request approved." : "Join request denied.", "success");
10827
10970
  await reloadData();
10828
10971
  } catch (error) {
10829
10972
  showGlobalNotice(error instanceof Error ? error.message : "Failed to review join request.", "warning");
@@ -10933,9 +11076,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10933
11076
  const archivedGroupCount = availableCoordinatorGroups().filter((group) => group.archived_at).length;
10934
11077
  const joinRequestCount = Array.isArray(state.lastCoordinatorAdminJoinRequests) ? state.lastCoordinatorAdminJoinRequests.length : 0;
10935
11078
  const deviceCount = Array.isArray(state.lastCoordinatorAdminDevices) ? state.lastCoordinatorAdminDevices.length : 0;
10936
- const headerMessage = summary.readiness !== "ready" ? summary.detail : targetArchived ? "The selected admin target group is archived. Restore it or switch groups before creating invites." : "";
11079
+ const headerMessage = summary.readiness !== "ready" ? summary.detail : targetArchived ? "The selected Team is archived. Restore it or switch Teams before creating invites." : "";
10937
11080
  if (coordinatorAdminState.activeSection === "invites" && !invitesEnabled || coordinatorAdminState.activeSection === "groups" && !groupsEnabled || coordinatorAdminState.activeSection === "join-requests" && !joinRequestsEnabled || coordinatorAdminState.activeSection === "devices" && !devicesEnabled) coordinatorAdminState.activeSection = summary.readiness === "ready" ? "groups" : "invites";
10938
- J$1(_$3("div", { class: "coordinator-admin-shell" }, _$3("div", { class: "card coordinator-admin-header" }, _$3("div", { class: "section-header" }, _$3("h2", null, "Coordinator Admin")), _$3("div", { class: "coordinator-admin-summary-grid" }, _$3("div", { class: "coordinator-admin-summary-card" }, _$3("span", { class: "section-meta" }, "Admin target"), _$3("strong", null, targetGroup || "None selected")), _$3("div", { class: "coordinator-admin-summary-card" }, _$3("span", { class: "section-meta" }, "Node discovery group"), _$3("strong", null, activeGroup || "None")), _$3("div", { class: "coordinator-admin-summary-card" }, _$3("span", { class: "section-meta" }, "Groups"), _$3("strong", null, `${activeGroupCount} active${archivedGroupCount ? ` · ${archivedGroupCount} archived` : ""}`)), _$3("div", { class: "coordinator-admin-summary-card" }, _$3("span", { class: "section-meta" }, "Selected group activity"), _$3("strong", null, `${joinRequestCount} join requests · ${deviceCount} devices`))), headerMessage ? _$3("div", { class: "peer-meta coordinator-admin-inline-warning" }, headerMessage) : null, coordinatorUrl ? _$3("div", { class: "section-meta coordinator-admin-inline-meta" }, `Coordinator: ${coordinatorUrl}`) : null), _$3("div", { class: "card coordinator-admin-sections" }, _$3(RadixTabs, {
11081
+ J$1(_$3("div", { class: "coordinator-admin-shell" }, _$3("div", { class: "card coordinator-admin-header" }, _$3("div", { class: "section-header" }, _$3("h2", null, "Teams")), _$3("div", { class: "coordinator-admin-summary-grid" }, _$3("div", { class: "coordinator-admin-summary-card" }, _$3("span", { class: "section-meta" }, "Team admin target"), _$3("strong", null, targetGroup || "None selected")), _$3("div", { class: "coordinator-admin-summary-card" }, _$3("span", { class: "section-meta" }, "Node discovery Team"), _$3("strong", null, activeGroup || "None")), _$3("div", { class: "coordinator-admin-summary-card" }, _$3("span", { class: "section-meta" }, "Teams"), _$3("strong", null, `${activeGroupCount} active${archivedGroupCount ? ` · ${archivedGroupCount} archived` : ""}`)), _$3("div", { class: "coordinator-admin-summary-card" }, _$3("span", { class: "section-meta" }, "Selected Team activity"), _$3("strong", null, `${joinRequestCount} join requests · ${deviceCount} devices`))), headerMessage ? _$3("div", { class: "peer-meta coordinator-admin-inline-warning" }, headerMessage) : null, coordinatorUrl ? _$3("div", { class: "section-meta coordinator-admin-inline-meta" }, `Coordinator: ${coordinatorUrl}`) : null), _$3("div", { class: "card coordinator-admin-sections" }, _$3(RadixTabs, {
10939
11082
  ariaLabel: "Coordinator admin sections",
10940
11083
  listClassName: "coordinator-admin-tabs-list",
10941
11084
  onValueChange: (value) => {
@@ -10945,7 +11088,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10945
11088
  tabs: [
10946
11089
  {
10947
11090
  value: "groups",
10948
- label: "Groups",
11091
+ label: "Teams",
10949
11092
  disabled: !groupsEnabled
10950
11093
  },
10951
11094
  {
@@ -10982,7 +11125,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10982
11125
  }), renderDevicesPanel({
10983
11126
  summary,
10984
11127
  runDevice: (deviceId, groupId, displayName, kind) => void runDeviceAction(deviceId, groupId, displayName, kind)
10985
- })), _$3("div", { class: "section-meta coordinator-admin-context-line" }, targetArchived ? `Selected group ${targetGroup || "—"} is archived. Switch or restore it to enable invite operations.` : targetGroup ? `Actions below apply to ${targetGroup}.` : "Select a group to start managing coordinator state."))), mount);
11128
+ })), _$3("div", { class: "section-meta coordinator-admin-context-line" }, targetArchived ? `Selected Team ${targetGroup || "—"} is archived. Switch or restore it to enable invite operations.` : targetGroup ? `Actions below apply to ${targetGroup}.` : "Select a Team to start managing people, Spaces, and access."))), mount);
10986
11129
  }
10987
11130
  function initCoordinatorAdminTab() {
10988
11131
  renderShell();
@@ -14442,6 +14585,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14442
14585
  var draftDomainSelections = /* @__PURE__ */ new Map();
14443
14586
  var pendingConfirmations = /* @__PURE__ */ new Map();
14444
14587
  var pendingForgetConfirmations = /* @__PURE__ */ new Map();
14588
+ var skippedProjectRefreshForActiveSelect = false;
14589
+ var coordinatorGroupNamesCurrent = false;
14445
14590
  function el(id) {
14446
14591
  return document.getElementById(id);
14447
14592
  }
@@ -14450,7 +14595,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14450
14595
  }
14451
14596
  function formatResolution(reason) {
14452
14597
  switch (reason) {
14453
- case "exact_mapping": return "assigned to a Sharing domain";
14598
+ case "exact_mapping": return "assigned to a Space";
14454
14599
  case "pattern_mapping": return "assigned by matching rule";
14455
14600
  case "explicit_override": return "manually assigned";
14456
14601
  default: return "stays on this device";
@@ -14475,13 +14620,127 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14475
14620
  function projectClusterLabel(project) {
14476
14621
  return project.project || project.display_project || strongestSignal(project);
14477
14622
  }
14478
- function scopeLabel(scopeId) {
14623
+ function teamName(groupId) {
14624
+ const normalized = String(groupId || "").trim();
14625
+ if (!normalized) return null;
14626
+ return state.lastCoordinatorAdminGroups.find((item) => String(item.group_id || "").trim() === normalized && !item.archived_at)?.display_name || "Team details unavailable";
14627
+ }
14628
+ function knownActiveCoordinatorGroupIds() {
14629
+ return new Set(state.lastCoordinatorAdminGroups.filter((item) => !item.archived_at).map((item) => String(item.group_id || "").trim()).filter(Boolean));
14630
+ }
14631
+ function isFromKnownInactiveCoordinatorGroup(scope) {
14632
+ if (!coordinatorGroupNamesCurrent || scope.authority_type !== "coordinator" || !scope.group_id) return false;
14633
+ return !knownActiveCoordinatorGroupIds().has(String(scope.group_id).trim());
14634
+ }
14635
+ function isProjectSpaceSelectActive() {
14636
+ const active = document.activeElement;
14637
+ return active instanceof HTMLSelectElement && active.classList.contains("project-domain-select");
14638
+ }
14639
+ function refreshSkippedProjectDataAfterSelectBlur() {
14640
+ if (!skippedProjectRefreshForActiveSelect) return;
14641
+ skippedProjectRefreshForActiveSelect = false;
14642
+ refreshProjects?.();
14643
+ }
14644
+ async function refreshProjectCoordinatorGroupNames() {
14645
+ try {
14646
+ const status = await loadCoordinatorAdminStatus();
14647
+ state.lastCoordinatorAdminStatus = status && typeof status === "object" ? status : null;
14648
+ } catch {
14649
+ state.lastCoordinatorAdminStatus = null;
14650
+ state.lastCoordinatorAdminGroups = [];
14651
+ coordinatorGroupNamesCurrent = false;
14652
+ return;
14653
+ }
14654
+ if (state.lastCoordinatorAdminStatus?.readiness !== "ready" || !state.lastCoordinatorAdminStatus.has_admin_secret) {
14655
+ state.lastCoordinatorAdminGroups = [];
14656
+ coordinatorGroupNamesCurrent = false;
14657
+ return;
14658
+ }
14659
+ try {
14660
+ const payload = await loadCoordinatorAdminGroupsFiltered(false);
14661
+ state.lastCoordinatorAdminGroups = Array.isArray(payload?.items) ? payload.items : [];
14662
+ coordinatorGroupNamesCurrent = true;
14663
+ } catch {
14664
+ state.lastCoordinatorAdminGroups = [];
14665
+ coordinatorGroupNamesCurrent = false;
14666
+ }
14667
+ }
14668
+ function isDefaultTeamSpace(scope) {
14669
+ return scope.kind === "team_default";
14670
+ }
14671
+ function spaceName(scope) {
14672
+ const label = scope.label || "Untitled Space";
14673
+ return isDefaultTeamSpace(scope) ? `${label} (default)` : label;
14674
+ }
14675
+ function spaceOptionName(scope, siblingScopes) {
14676
+ const label = spaceName(scope);
14677
+ return siblingScopes.some((sibling) => sibling.scope_id !== scope.scope_id && spaceName(sibling) === label) ? `${label} · Space ID ${scope.scope_id}` : label;
14678
+ }
14679
+ function spaceOwner(scope) {
14680
+ const team = teamName(scope.group_id);
14681
+ if (team) return `Team: ${team}`;
14682
+ if (scope.authority_type === "local") return "Local device";
14683
+ if (scope.authority_type === "coordinator") return "Coordinator Space";
14684
+ return `${scope.authority_type || "Other"} Space`;
14685
+ }
14686
+ function scopeById(scopeId) {
14687
+ if (!scopeId) return null;
14688
+ return scopes.find((item) => item.scope_id === scopeId) ?? null;
14689
+ }
14690
+ function scopeSummary(scopeId) {
14691
+ const scope = scopeById(scopeId);
14479
14692
  if (!scopeId) return "—";
14480
- const scope = scopes.find((item) => item.scope_id === scopeId);
14481
- return scope?.label ? `${scope.label} (${scope.scope_id})` : scopeId;
14693
+ return scope ? `${spaceName(scope)} · ${spaceOwner(scope)}` : "Unknown Space";
14482
14694
  }
14483
14695
  function assignableScopes() {
14484
- return scopes.filter((scope) => scope.scope_id !== "legacy-shared-review");
14696
+ return scopes.filter((scope) => scope.scope_id !== "legacy-shared-review" && !isFromKnownInactiveCoordinatorGroup(scope));
14697
+ }
14698
+ function isAssignableScopeId(scopeId) {
14699
+ return assignableScopes().some((scope) => scope.scope_id === scopeId);
14700
+ }
14701
+ function firstSafeSelection(...scopeIds) {
14702
+ for (const scopeId of scopeIds) if (scopeId && isAssignableScopeId(scopeId)) return scopeId;
14703
+ return scopeIds.find((scopeId) => Boolean(scopeId)) ?? "";
14704
+ }
14705
+ function scopeGroupLabel(scope) {
14706
+ const team = teamName(scope.group_id);
14707
+ if (team) return `Team: ${team}`;
14708
+ if (scope.authority_type === "local") return "Local device";
14709
+ if (scope.authority_type === "coordinator") return "Coordinator Spaces";
14710
+ return "Other Spaces";
14711
+ }
14712
+ function scopeGroupKey(scope) {
14713
+ if (scope.group_id) return `team:${scope.group_id}`;
14714
+ return `${scope.authority_type || "other"}:${scope.kind || "space"}`;
14715
+ }
14716
+ function groupedAssignableScopes() {
14717
+ const groups = /* @__PURE__ */ new Map();
14718
+ for (const scope of assignableScopes()) {
14719
+ const key = scopeGroupKey(scope);
14720
+ const label = scopeGroupLabel(scope);
14721
+ const current = groups.get(key) ?? {
14722
+ label,
14723
+ scopes: []
14724
+ };
14725
+ groups.set(key, {
14726
+ label: current.label,
14727
+ scopes: [...current.scopes, scope]
14728
+ });
14729
+ }
14730
+ return [...groups.values()];
14731
+ }
14732
+ function appendAssignableScopeOptions(select) {
14733
+ for (const group of groupedAssignableScopes()) {
14734
+ const optgroup = document.createElement("optgroup");
14735
+ optgroup.label = group.label;
14736
+ for (const scope of group.scopes) {
14737
+ const option = document.createElement("option");
14738
+ option.value = scope.scope_id;
14739
+ option.textContent = spaceOptionName(scope, group.scopes);
14740
+ optgroup.appendChild(option);
14741
+ }
14742
+ select.appendChild(optgroup);
14743
+ }
14485
14744
  }
14486
14745
  function guardrailHeading(warning) {
14487
14746
  switch (warning.code) {
@@ -14504,7 +14763,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14504
14763
  });
14505
14764
  pendingConfirmations.delete(project.workspace_identity);
14506
14765
  draftDomainSelections.delete(project.workspace_identity);
14507
- showGlobalNotice("Project Sharing domain updated. Device access grants are unchanged.");
14766
+ showGlobalNotice("Project Space assignment updated. Device access grants are unchanged.");
14508
14767
  refreshProjects?.();
14509
14768
  } catch (error) {
14510
14769
  if (error instanceof SharingDomainGuardrailConfirmationError) {
@@ -14516,7 +14775,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14516
14775
  refreshProjects?.();
14517
14776
  return;
14518
14777
  }
14519
- showGlobalNotice(error instanceof Error ? error.message : "Unable to update project Sharing domain.", "warning");
14778
+ showGlobalNotice(error instanceof Error ? error.message : "Unable to update project Space.", "warning");
14520
14779
  }
14521
14780
  }
14522
14781
  async function saveProjectClusterMapping(projects, scopeId) {
@@ -14532,7 +14791,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14532
14791
  showGlobalNotice(`Updated ${assignable.length} project identit${assignable.length === 1 ? "y" : "ies"}. Device access grants are unchanged.`);
14533
14792
  refreshProjects?.();
14534
14793
  } catch (error) {
14535
- showGlobalNotice(error instanceof SharingDomainGuardrailConfirmationError ? "One or more identities in this group need review before bulk assignment. Expand the group and save those identities directly." : error instanceof Error ? error.message : "Unable to update project Sharing domains.", "warning");
14794
+ showGlobalNotice(error instanceof SharingDomainGuardrailConfirmationError ? "One or more identities in this group need review before bulk assignment. Expand the group and save those identities directly." : error instanceof Error ? error.message : "Unable to update project Spaces.", "warning");
14536
14795
  }
14537
14796
  }
14538
14797
  async function removeProjectMapping(project) {
@@ -14541,10 +14800,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14541
14800
  await deleteSharingDomainProjectMapping(project.mapping_id);
14542
14801
  pendingConfirmations.delete(project.workspace_identity);
14543
14802
  draftDomainSelections.delete(project.workspace_identity);
14544
- showGlobalNotice("Project Sharing domain mapping removed. The next fallback now applies.");
14803
+ showGlobalNotice("Project Space assignment removed. The next fallback now applies.");
14545
14804
  refreshProjects?.();
14546
14805
  } catch (error) {
14547
- showGlobalNotice(error instanceof Error ? error.message : "Unable to remove project Sharing domain mapping.", "warning");
14806
+ showGlobalNotice(error instanceof Error ? error.message : "Unable to remove project Space assignment.", "warning");
14548
14807
  }
14549
14808
  }
14550
14809
  async function forgetProjectMemories(project, confirmed = false) {
@@ -14581,7 +14840,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14581
14840
  const nextProject = await openSyncInputDialog({
14582
14841
  cancelLabel: "Cancel",
14583
14842
  confirmLabel: "Change project",
14584
- description: `This will update ${project.session_count} session${project.session_count === 1 ? "" : "s"} and ${project.memory_count ?? 0} memor${project.memory_count === 1 ? "y" : "ies"} by changing the stored project. Sharing-domain assignment stays unchanged.`,
14843
+ description: `This will update ${project.session_count} session${project.session_count === 1 ? "" : "s"} and ${project.memory_count ?? 0} memor${project.memory_count === 1 ? "y" : "ies"} by changing the stored project. Space assignment stays unchanged.`,
14585
14844
  initialValue: currentProject,
14586
14845
  placeholder: "Project name",
14587
14846
  suggestions,
@@ -14619,7 +14878,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14619
14878
  label.className = "sr-only";
14620
14879
  const selectId = `project-domain-${project.workspace_identity.replace(/[^a-z0-9_-]/gi, "-")}`;
14621
14880
  label.htmlFor = selectId;
14622
- label.textContent = `Sharing domain for ${project.display_project}`;
14881
+ label.textContent = `Space for ${project.display_project}`;
14623
14882
  const select = document.createElement("select");
14624
14883
  select.id = selectId;
14625
14884
  select.className = "project-domain-select";
@@ -14627,30 +14886,27 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14627
14886
  if (!currentAssignable && project.resolved_scope_id) {
14628
14887
  const current = document.createElement("option");
14629
14888
  current.value = project.resolved_scope_id;
14630
- current.textContent = `${scopeLabel(project.resolved_scope_id)} — not assignable`;
14889
+ current.textContent = `${scopeSummary(project.resolved_scope_id)} — not assignable`;
14631
14890
  current.disabled = true;
14632
14891
  select.appendChild(current);
14633
14892
  }
14634
- for (const scope of assignableScopes()) {
14635
- const option = document.createElement("option");
14636
- option.value = scope.scope_id;
14637
- option.textContent = scope.label ? `${scope.label} · ${scope.scope_id}` : scope.scope_id;
14638
- select.appendChild(option);
14639
- }
14640
- select.value = draftDomainSelections.get(project.workspace_identity) ?? project.suggested_scope_id ?? project.resolved_scope_id;
14893
+ appendAssignableScopeOptions(select);
14894
+ select.value = firstSafeSelection(draftDomainSelections.get(project.workspace_identity), project.suggested_scope_id, project.resolved_scope_id);
14641
14895
  const save = document.createElement("button");
14642
14896
  save.className = "settings-button";
14643
14897
  save.type = "button";
14644
- save.textContent = project.suggested_scope_id && select.value === project.suggested_scope_id ? "Confirm suggestion" : "Save domain";
14645
- save.disabled = select.value === project.resolved_scope_id && !currentAssignable;
14898
+ save.textContent = project.suggested_scope_id && select.value === project.suggested_scope_id ? "Confirm suggestion" : "Save Space";
14899
+ save.disabled = !select.value || select.value === project.resolved_scope_id && !currentAssignable;
14646
14900
  save.addEventListener("click", () => void saveProjectMapping(project, select.value));
14647
14901
  select.addEventListener("change", () => {
14648
14902
  draftDomainSelections.set(project.workspace_identity, select.value);
14649
14903
  pendingConfirmations.delete(project.workspace_identity);
14650
- save.textContent = "Save domain";
14651
- save.disabled = false;
14904
+ actions.querySelector(".project-space-guardrail-confirmation")?.remove();
14905
+ save.textContent = "Save Space";
14906
+ save.disabled = !select.value;
14652
14907
  refreshProjects?.();
14653
14908
  });
14909
+ select.addEventListener("blur", refreshSkippedProjectDataAfterSelectBlur);
14654
14910
  const keepLocal = document.createElement("button");
14655
14911
  keepLocal.className = "settings-button";
14656
14912
  keepLocal.type = "button";
@@ -14679,10 +14935,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14679
14935
  const pending = pendingConfirmations.get(project.workspace_identity);
14680
14936
  if (pending) {
14681
14937
  const warningBox = document.createElement("div");
14682
- warningBox.className = "settings-note project-guardrail-confirmation";
14938
+ warningBox.className = "settings-note project-guardrail-confirmation project-space-guardrail-confirmation";
14683
14939
  warningBox.setAttribute("role", "alert");
14684
14940
  const title = document.createElement("strong");
14685
- title.textContent = "Confirmation required before saving this Sharing domain.";
14941
+ title.textContent = "Confirmation required before saving this Space.";
14686
14942
  const intro = document.createElement("p");
14687
14943
  intro.textContent = "Codemem can save this change after you acknowledge the checks below. Verify the workspace details, then confirm to complete the save.";
14688
14944
  const list = document.createElement("ul");
@@ -14698,7 +14954,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14698
14954
  const confirm = document.createElement("button");
14699
14955
  confirm.className = "settings-button";
14700
14956
  confirm.type = "button";
14701
- confirm.textContent = "I understand, save domain";
14957
+ confirm.textContent = "I understand, save Space";
14702
14958
  confirm.addEventListener("click", () => {
14703
14959
  const currentPending = pendingConfirmations.get(project.workspace_identity);
14704
14960
  if (!currentPending || currentPending.scopeId !== select.value) return;
@@ -14755,7 +15011,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14755
15011
  header.appendChild(title);
14756
15012
  const domain = document.createElement("div");
14757
15013
  domain.className = "project-inventory-domain";
14758
- domain.textContent = scopeLabel(project.resolved_scope_id);
15014
+ domain.textContent = scopeSummary(project.resolved_scope_id);
14759
15015
  header.appendChild(domain);
14760
15016
  row.appendChild(header);
14761
15017
  const meta = document.createElement("div");
@@ -14769,7 +15025,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14769
15025
  if (project.suggested_scope_id && project.suggested_scope_id !== project.resolved_scope_id) {
14770
15026
  const suggestion = document.createElement("div");
14771
15027
  suggestion.className = "settings-note project-suggestion-note";
14772
- suggestion.textContent = project.suggestion_reason ? `Suggestion: ${project.suggestion_reason}` : `Suggestion: map this project to ${scopeLabel(project.suggested_scope_id)}.`;
15028
+ suggestion.textContent = project.suggestion_reason ? `Suggestion: ${project.suggestion_reason}` : `Suggestion: assign this project to ${scopeSummary(project.suggested_scope_id)}.`;
14773
15029
  row.appendChild(suggestion);
14774
15030
  }
14775
15031
  const warnings = project.guardrail_warnings.filter((warning) => warning.severity === "warning");
@@ -14808,7 +15064,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14808
15064
  ["CWD", project.cwd],
14809
15065
  ["Git remote", project.git_remote],
14810
15066
  ["Git branch", project.git_branch],
14811
- ["Suggested domain", project.suggested_scope_id],
15067
+ ["Current Space", scopeSummary(project.resolved_scope_id)],
15068
+ ["Suggested Space", project.suggested_scope_id ? scopeSummary(project.suggested_scope_id) : null],
15069
+ ["Advanced: current Space ID", project.resolved_scope_id],
15070
+ ["Advanced: suggested Space ID", project.suggested_scope_id],
14812
15071
  ["Suggestion reason", project.suggestion_reason],
14813
15072
  ["Sessions", project.session_count],
14814
15073
  ["Memories", project.memory_count ?? "count unavailable"]
@@ -14827,7 +15086,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14827
15086
  }
14828
15087
  function clusterDomainLabel(projects) {
14829
15088
  const uniqueScopes = [...new Set(projects.map((project) => project.resolved_scope_id))];
14830
- return uniqueScopes.length === 1 ? scopeLabel(uniqueScopes[0]) : "Mixed Sharing domains";
15089
+ return uniqueScopes.length === 1 ? scopeSummary(uniqueScopes[0]) : "Mixed Spaces";
14831
15090
  }
14832
15091
  function renderProjectCluster(projects) {
14833
15092
  if (projects.length === 1) return renderProjectRow(projects[0]);
@@ -14858,32 +15117,28 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14858
15117
  const resolvedScopes = new Set(projects.map((project) => project.resolved_scope_id));
14859
15118
  const select = document.createElement("select");
14860
15119
  select.className = "project-domain-select";
14861
- select.setAttribute("aria-label", `Sharing domain for ${projectClusterLabel(projects[0])} group`);
15120
+ select.setAttribute("aria-label", `Space for ${projectClusterLabel(projects[0])} group`);
14862
15121
  const placeholder = document.createElement("option");
14863
15122
  placeholder.value = "";
14864
- placeholder.textContent = "Choose domain…";
15123
+ placeholder.textContent = "Choose Space…";
14865
15124
  select.appendChild(placeholder);
14866
- for (const scope of assignableScopes()) {
14867
- const option = document.createElement("option");
14868
- option.value = scope.scope_id;
14869
- option.textContent = scope.label ? `${scope.label} · ${scope.scope_id}` : scope.scope_id;
14870
- select.appendChild(option);
14871
- }
15125
+ appendAssignableScopeOptions(select);
14872
15126
  select.value = "";
14873
15127
  const save = document.createElement("button");
14874
15128
  save.className = "settings-button";
14875
15129
  save.type = "button";
14876
- save.textContent = `Save domain for ${projects.length} identities`;
15130
+ save.textContent = `Save Space for ${projects.length} identities`;
14877
15131
  save.disabled = true;
14878
15132
  save.addEventListener("click", () => void saveProjectClusterMapping(projects, select.value));
14879
15133
  select.addEventListener("change", () => {
14880
15134
  save.disabled = !select.value || hasGuardrailWarnings;
14881
15135
  });
15136
+ select.addEventListener("blur", refreshSkippedProjectDataAfterSelectBlur);
14882
15137
  actions.append(select, save);
14883
15138
  if (suggestedScopes.size > 1 || resolvedScopes.size > 1 || hasGuardrailWarnings) {
14884
15139
  const note = document.createElement("div");
14885
15140
  note.className = "settings-note project-attention-note";
14886
- note.textContent = hasGuardrailWarnings ? "One or more identities in this group need individual review before bulk assignment." : "This group has mixed suggestions or current domains. Choose a domain explicitly before bulk assignment.";
15141
+ note.textContent = hasGuardrailWarnings ? "One or more identities in this group need individual review before bulk assignment." : "This group has mixed suggestions or current Spaces. Choose a Space explicitly before bulk assignment.";
14887
15142
  actions.appendChild(note);
14888
15143
  }
14889
15144
  row.appendChild(actions);
@@ -14918,10 +15173,34 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14918
15173
  empty.textContent = message;
14919
15174
  list.appendChild(empty);
14920
15175
  }
15176
+ function renderProjectInventory(result) {
15177
+ const meta = el("projectsInventoryMeta");
15178
+ const list = el("projectsInventoryList");
15179
+ if (!meta || !list) return;
15180
+ list.textContent = "";
15181
+ if (result.projects.length === 0) renderEmpty("No projects match those filters.");
15182
+ else for (const cluster of projectClusters(result.projects)) list.appendChild(renderProjectCluster(cluster));
15183
+ meta.textContent = result.total === 0 ? "0 project identities found" : `${result.total} project identit${result.total === 1 ? "y" : "ies"} found · showing ${result.offset + 1}-${Math.min(result.offset + result.projects.length, result.total)}`;
15184
+ const prev = el("projectsPrevPage");
15185
+ const next = el("projectsNextPage");
15186
+ if (prev) prev.disabled = result.offset === 0;
15187
+ if (next) next.disabled = !result.has_more;
15188
+ }
15189
+ function refreshProjectCoordinatorGroupNamesInBackground(result) {
15190
+ refreshProjectCoordinatorGroupNames().then(() => {
15191
+ if (isProjectSpaceSelectActive()) return;
15192
+ renderProjectInventory(result);
15193
+ });
15194
+ }
14921
15195
  async function loadProjectsData() {
14922
15196
  const meta = el("projectsInventoryMeta");
14923
15197
  const list = el("projectsInventoryList");
14924
15198
  if (!meta || !list) return;
15199
+ if (isProjectSpaceSelectActive()) {
15200
+ skippedProjectRefreshForActiveSelect = true;
15201
+ return;
15202
+ }
15203
+ skippedProjectRefreshForActiveSelect = false;
14925
15204
  meta.textContent = "Loading project inventory…";
14926
15205
  try {
14927
15206
  const [result, settings] = await Promise.all([loadProjectScopeInventory({
@@ -14931,14 +15210,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14931
15210
  status: el("projectsStatusFilter")?.value || void 0
14932
15211
  }), loadSharingDomainSettings()]);
14933
15212
  scopes = settings.scopes;
14934
- list.textContent = "";
14935
- if (result.projects.length === 0) renderEmpty("No projects match those filters.");
14936
- else for (const cluster of projectClusters(result.projects)) list.appendChild(renderProjectCluster(cluster));
14937
- meta.textContent = result.total === 0 ? "0 project identities found" : `${result.total} project identit${result.total === 1 ? "y" : "ies"} found · showing ${result.offset + 1}-${Math.min(result.offset + result.projects.length, result.total)}`;
14938
- const prev = el("projectsPrevPage");
14939
- const next = el("projectsNextPage");
14940
- if (prev) prev.disabled = result.offset === 0;
14941
- if (next) next.disabled = !result.has_more;
15213
+ renderProjectInventory(result);
15214
+ refreshProjectCoordinatorGroupNamesInBackground(result);
14942
15215
  } catch (error) {
14943
15216
  meta.textContent = "Project inventory failed to load.";
14944
15217
  renderEmpty(error instanceof Error ? error.message : "Unable to load project inventory.");
@@ -16569,8 +16842,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16569
16842
  //#endregion
16570
16843
  //#region src/tabs/settings/components/SharingDomainsPanel.tsx
16571
16844
  function domainLabel(scope) {
16845
+ const team = scope.group_id ? `Team ${scope.group_id}` : scope.authority_type;
16572
16846
  const qualifier = scope.authority_type === "local" ? "local" : scope.authority_type;
16573
- return `${scope.label || scope.scope_id} · ${qualifier}`;
16847
+ return `${scope.label || scope.scope_id} · ${team || qualifier}`;
16574
16848
  }
16575
16849
  function projectSubtitle(project) {
16576
16850
  if (project.git_remote) return `Matched by git remote · ${project.git_remote}`;
@@ -16611,7 +16885,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16611
16885
  function settingsMappingWarnings(settings) {
16612
16886
  return settings.mappings.flatMap((mapping) => mapping.guardrail_warnings ?? []);
16613
16887
  }
16614
- function GuardrailMessages({ label = "Sharing domain guardrail", warnings }) {
16888
+ function GuardrailMessages({ label = "Space assignment guardrail", warnings }) {
16615
16889
  if (warnings.length === 0) return null;
16616
16890
  return /* @__PURE__ */ u("div", {
16617
16891
  "aria-label": label,
@@ -16635,7 +16909,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16635
16909
  setSettings(next);
16636
16910
  setDrafts(resetDrafts(next));
16637
16911
  } catch (err) {
16638
- setError(err instanceof Error ? err.message : "Unable to load Sharing domains");
16912
+ setError(err instanceof Error ? err.message : "Unable to load Spaces");
16639
16913
  } finally {
16640
16914
  setLoading(false);
16641
16915
  }
@@ -16667,7 +16941,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16667
16941
  scope_id: scopeId
16668
16942
  });
16669
16943
  setConfirmation(null);
16670
- showGlobalNotice("Project Sharing domain updated. Device access grants are unchanged.");
16944
+ showGlobalNotice("Project Space assignment updated. Device access grants are unchanged.");
16671
16945
  await reload();
16672
16946
  } catch (err) {
16673
16947
  if (err instanceof SharingDomainGuardrailConfirmationError) {
@@ -16678,7 +16952,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16678
16952
  });
16679
16953
  return;
16680
16954
  }
16681
- setError(err instanceof Error ? err.message : "Unable to save Sharing domain mapping");
16955
+ setError(err instanceof Error ? err.message : "Unable to save Space assignment");
16682
16956
  } finally {
16683
16957
  setSavingKey(null);
16684
16958
  }
@@ -16690,10 +16964,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16690
16964
  try {
16691
16965
  await deleteSharingDomainProjectMapping(project.mapping_id);
16692
16966
  setConfirmation(null);
16693
- showGlobalNotice("Project Sharing domain mapping removed. The next fallback now applies.");
16967
+ showGlobalNotice("Project Space assignment removed. The next fallback now applies.");
16694
16968
  await reload();
16695
16969
  } catch (err) {
16696
- setError(err instanceof Error ? err.message : "Unable to reset Sharing domain mapping");
16970
+ setError(err instanceof Error ? err.message : "Unable to reset Space assignment");
16697
16971
  } finally {
16698
16972
  setSavingKey(null);
16699
16973
  }
@@ -16706,15 +16980,15 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16706
16980
  children: [
16707
16981
  /* @__PURE__ */ u("h3", {
16708
16982
  className: "settings-group-title",
16709
- children: "Advanced Sharing-domain mappings"
16983
+ children: "Advanced Space assignments"
16710
16984
  }),
16711
16985
  /* @__PURE__ */ u("div", {
16712
16986
  className: "small",
16713
- children: "Use Projects for day-to-day project/domain review. This fallback panel exposes the same mapping controls for troubleshooting and recovery."
16987
+ children: "Use Projects for day-to-day project/Space review. This fallback panel exposes the same assignment controls for troubleshooting and recovery."
16714
16988
  }),
16715
16989
  /* @__PURE__ */ u("div", {
16716
16990
  className: "small",
16717
- children: "Saving a mapping changes local scope resolution for future writes; it does not grant any peer or coordinator member access by itself."
16991
+ children: "Saving an assignment changes local Space resolution for future writes; it does not grant any device or Team member access by itself."
16718
16992
  }),
16719
16993
  /* @__PURE__ */ u("div", {
16720
16994
  className: "section-actions",
@@ -16726,12 +17000,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16726
17000
  })
16727
17001
  }),
16728
17002
  settings ? /* @__PURE__ */ u(GuardrailMessages, {
16729
- label: "Sharing domain mapping warnings",
17003
+ label: "Space assignment warnings",
16730
17004
  warnings: settingsMappingWarnings(settings)
16731
17005
  }) : null,
16732
17006
  loading && !settings ? /* @__PURE__ */ u("div", {
16733
17007
  className: "small",
16734
- children: "Loading Sharing domains…"
17008
+ children: "Loading Spaces…"
16735
17009
  }) : null,
16736
17010
  error ? /* @__PURE__ */ u("div", {
16737
17011
  className: "settings-note",
@@ -16765,7 +17039,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16765
17039
  children: projectSubtitle(project)
16766
17040
  }),
16767
17041
  /* @__PURE__ */ u(RadixSelect, {
16768
- ariaLabel: `Sharing domain for ${project.display_project}`,
17042
+ ariaLabel: `Space for ${project.display_project}`,
16769
17043
  contentClassName: "settings-select-content",
16770
17044
  disabled: !assignable || saving || scopeOptions.length === 0,
16771
17045
  id: fieldId,
@@ -16778,7 +17052,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16778
17052
  if (confirmation?.workspaceIdentity === project.workspace_identity) setConfirmation(null);
16779
17053
  },
16780
17054
  options: scopeOptions,
16781
- placeholder: "Choose Sharing domain",
17055
+ placeholder: "Choose Space",
16782
17056
  triggerClassName: "settings-select-trigger",
16783
17057
  value: currentValue,
16784
17058
  viewportClassName: "settings-select-viewport"
@@ -16786,7 +17060,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16786
17060
  /* @__PURE__ */ u("div", {
16787
17061
  className: "small",
16788
17062
  children: [
16789
- "Current default: ",
17063
+ "Current Space: ",
16790
17064
  currentScopeName,
16791
17065
  " · ",
16792
17066
  resolutionLabel(project.resolution_reason)
@@ -16804,13 +17078,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16804
17078
  /* @__PURE__ */ u(GuardrailMessages, { warnings: visibleProjectWarnings(project) }),
16805
17079
  !assignable ? /* @__PURE__ */ u("div", {
16806
17080
  className: "settings-note",
16807
- children: "This project is missing a stable identity, so Sharing domain assignment is disabled. Add a path, git remote, or workspace id first; until then it remains Local only."
17081
+ children: "This project is missing a stable identity, so Space assignment is disabled. Add a path, git remote, or workspace id first; until then it remains Local only."
16808
17082
  }) : null,
16809
17083
  pendingConfirmation ? /* @__PURE__ */ u("div", {
16810
17084
  className: "settings-note",
16811
17085
  role: "alert",
16812
17086
  children: [
16813
- /* @__PURE__ */ u("strong", { children: "Review before saving this Sharing domain." }),
17087
+ /* @__PURE__ */ u("strong", { children: "Review before saving this Space assignment." }),
16814
17088
  /* @__PURE__ */ u("ul", { children: pendingConfirmation.warnings.map((warning, warningIndex) => /* @__PURE__ */ u("li", { children: warning.message }, warningKey(warning, warningIndex))) }),
16815
17089
  /* @__PURE__ */ u("div", {
16816
17090
  className: "section-actions",
@@ -16837,7 +17111,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16837
17111
  disabled: !assignable || saving || unchanged,
16838
17112
  onClick: () => void saveProject(project),
16839
17113
  type: "button",
16840
- children: saving ? "Saving…" : usingSuggestion ? "Confirm suggested mapping" : "Save Sharing domain"
17114
+ children: saving ? "Saving…" : usingSuggestion ? "Confirm suggested mapping" : "Save Space"
16841
17115
  }), /* @__PURE__ */ u("button", {
16842
17116
  className: "settings-button",
16843
17117
  disabled: saving || !canRemoveProjectMapping,
@@ -21929,7 +22203,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
21929
22203
  try {
21930
22204
  const runtime = await loadRuntimeInfo();
21931
22205
  if (!runtime?.version) return;
21932
- setRuntimeLabel(runtime.version, "ec4d4cc");
22206
+ setRuntimeLabel(runtime.version, "ddca13f");
21933
22207
  } catch {}
21934
22208
  }
21935
22209
  var lastAnnouncedRefreshState = null;