@codemem/server 0.26.2 → 0.27.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
@@ -435,6 +435,12 @@
435
435
  }
436
436
  //#endregion
437
437
  //#region src/lib/state.ts
438
+ var ALL_TAB_IDS = [
439
+ "feed",
440
+ "health",
441
+ "sync",
442
+ "coordinator-admin"
443
+ ];
438
444
  var TAB_KEY = "codemem-tab";
439
445
  var FEED_FILTER_KEY = "codemem-feed-filter";
440
446
  var FEED_SCOPE_KEY = "codemem-feed-scope";
@@ -503,27 +509,28 @@
503
509
  syncDiagnosticsOpen: false,
504
510
  syncPairingOpen: false
505
511
  };
512
+ function shouldShowCoordinatorAdminTab(status) {
513
+ if (!status) return true;
514
+ return status.has_admin_secret === true;
515
+ }
516
+ function getVisibleTabs(status) {
517
+ return shouldShowCoordinatorAdminTab(status) ? [...ALL_TAB_IDS] : ALL_TAB_IDS.filter((tabId) => tabId !== "coordinator-admin");
518
+ }
519
+ function resolveAccessibleTab(tab, status) {
520
+ return getVisibleTabs(status).includes(tab) ? tab : "sync";
521
+ }
506
522
  function getActiveTab() {
507
523
  const hash = window.location.hash.replace("#", "");
508
- if ([
509
- "feed",
510
- "health",
511
- "sync",
512
- "coordinator-admin"
513
- ].includes(hash)) return hash;
524
+ if (ALL_TAB_IDS.includes(hash)) return resolveAccessibleTab(hash, state.lastCoordinatorAdminStatus);
514
525
  const saved = localStorage.getItem(TAB_KEY);
515
- if (saved && [
516
- "feed",
517
- "health",
518
- "sync",
519
- "coordinator-admin"
520
- ].includes(saved)) return saved;
526
+ if (saved && ALL_TAB_IDS.includes(saved)) return resolveAccessibleTab(saved, state.lastCoordinatorAdminStatus);
521
527
  return "feed";
522
528
  }
523
529
  function setActiveTab(tab) {
524
- state.activeTab = tab;
525
- window.location.hash = tab;
526
- localStorage.setItem(TAB_KEY, tab);
530
+ const nextTab = resolveAccessibleTab(tab, state.lastCoordinatorAdminStatus);
531
+ state.activeTab = nextTab;
532
+ window.location.hash = nextTab;
533
+ localStorage.setItem(TAB_KEY, nextTab);
527
534
  }
528
535
  function getFeedTypeFilter() {
529
536
  const saved = localStorage.getItem(FEED_FILTER_KEY) || "all";
@@ -6729,6 +6736,16 @@
6729
6736
  });
6730
6737
  }
6731
6738
  //#endregion
6739
+ //#region src/components/primitives/text-area.tsx
6740
+ function TextArea(props) {
6741
+ return /* @__PURE__ */ u("textarea", { ...props });
6742
+ }
6743
+ //#endregion
6744
+ //#region src/components/primitives/text-input.tsx
6745
+ function TextInput(props) {
6746
+ return /* @__PURE__ */ u("input", { ...props });
6747
+ }
6748
+ //#endregion
6732
6749
  //#region src/lib/notice.ts
6733
6750
  var hideAbort = null;
6734
6751
  function hideGlobalNotice() {
@@ -7468,7 +7485,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
7468
7485
  }) : null,
7469
7486
  request.kind === "input" ? /* @__PURE__ */ u("div", {
7470
7487
  className: "field",
7471
- children: [/* @__PURE__ */ u("input", {
7488
+ children: [/* @__PURE__ */ u(TextInput, {
7472
7489
  "aria-describedby": errorText ? `${descriptionId} ${inputErrorId}` : descriptionId,
7473
7490
  autoFocus: true,
7474
7491
  className: errorText ? "sync-dialog-input sync-field-error" : "sync-dialog-input",
@@ -7886,13 +7903,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
7886
7903
  return _$1(RadixTabsContent, {
7887
7904
  className: "coordinator-admin-panel",
7888
7905
  value: "invites"
7889
- }, _$1("h3", null, "Create teammate invite"), _$1("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."), _$1("div", { class: "coordinator-admin-form-grid" }, _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Group"), _$1("input", {
7906
+ }, _$1("h3", null, "Create teammate invite"), _$1("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."), _$1("div", { class: "coordinator-admin-form-grid" }, _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Group"), _$1(TextInput, {
7890
7907
  class: "peer-scope-input",
7891
7908
  disabled: summary.readiness !== "ready",
7892
7909
  onInput: (event) => {
7893
7910
  inviteGroup = String(event.currentTarget.value || "");
7894
7911
  },
7895
7912
  placeholder: activeGroup || "team-alpha",
7913
+ type: "text",
7896
7914
  value: inviteGroup
7897
7915
  })), _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Join policy"), _$1(RadixSelect, {
7898
7916
  ariaLabel: "Invite join policy",
@@ -7914,7 +7932,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
7914
7932
  triggerClassName: "sync-radix-select-trigger sync-actor-select",
7915
7933
  value: invitePolicy,
7916
7934
  viewportClassName: "sync-radix-select-viewport"
7917
- })), _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Expires in (hours)"), _$1("input", {
7935
+ })), _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Expires in (hours)"), _$1(TextInput, {
7918
7936
  class: "peer-scope-input",
7919
7937
  disabled: summary.readiness !== "ready",
7920
7938
  min: "1",
@@ -7930,7 +7948,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
7930
7948
  createInviteFromAdminPanel();
7931
7949
  },
7932
7950
  type: "button"
7933
- }, invitePending ? "Creating…" : "Create invite"), effectiveGroup ? _$1("span", { class: "peer-submeta" }, `Using group ${effectiveGroup}`) : null), output ? _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Generated invite"), _$1("textarea", {
7951
+ }, invitePending ? "Creating…" : "Create invite"), effectiveGroup ? _$1("span", { class: "peer-submeta" }, `Using group ${effectiveGroup}`) : null), output ? _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Generated invite"), _$1(TextArea, {
7934
7952
  class: "feed-search coordinator-admin-output",
7935
7953
  readOnly: true,
7936
7954
  value: output
@@ -7953,21 +7971,23 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
7953
7971
  return _$1(RadixTabsContent, {
7954
7972
  className: "coordinator-admin-panel",
7955
7973
  value: "groups"
7956
- }, _$1("h3", null, "Groups"), _$1("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 ? _$1("p", { class: "peer-submeta" }, countParts.join(" · ")) : null, !targetExists && selectedGroup ? _$1("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, _$1("div", { class: "coordinator-admin-form-grid" }, _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "New group id"), _$1("input", {
7974
+ }, _$1("h3", null, "Groups"), _$1("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 ? _$1("p", { class: "peer-submeta" }, countParts.join(" · ")) : null, !targetExists && selectedGroup ? _$1("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, _$1("div", { class: "coordinator-admin-form-grid" }, _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "New group id"), _$1(TextInput, {
7957
7975
  class: "peer-scope-input",
7958
7976
  disabled: summary.readiness !== "ready" || groupActionPendingKind === "create",
7959
7977
  onInput: (event) => {
7960
7978
  createGroupId = String(event.currentTarget.value || "");
7961
7979
  },
7962
7980
  placeholder: "team-alpha",
7981
+ type: "text",
7963
7982
  value: createGroupId
7964
- })), _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Display name"), _$1("input", {
7983
+ })), _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Display name"), _$1(TextInput, {
7965
7984
  class: "peer-scope-input",
7966
7985
  disabled: summary.readiness !== "ready" || groupActionPendingKind === "create",
7967
7986
  onInput: (event) => {
7968
7987
  createGroupDisplayName = String(event.currentTarget.value || "");
7969
7988
  },
7970
7989
  placeholder: "Team Alpha",
7990
+ type: "text",
7971
7991
  value: createGroupDisplayName
7972
7992
  }))), _$1("div", { class: "section-actions coordinator-admin-groups-toolbar" }, _$1("div", { class: "coordinator-admin-primary-actions" }, _$1("button", {
7973
7993
  class: "settings-button",
@@ -7995,12 +8015,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
7995
8015
  return _$1("div", {
7996
8016
  class: "peer-card",
7997
8017
  key: group.group_id
7998
- }, _$1("div", { class: "peer-title" }, _$1("strong", null, draftName)), _$1("div", { class: "peer-meta" }, `Group ID: ${group.group_id}`), _$1("div", { class: "peer-submeta" }, archived ? "Archived" : "Active"), configuredGroup === group.group_id ? _$1("div", { class: "peer-submeta" }, "This node is configured to use this group for coordinator-backed discovery.") : null, _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Display name"), _$1("input", {
8018
+ }, _$1("div", { class: "peer-title" }, _$1("strong", null, draftName)), _$1("div", { class: "peer-meta" }, `Group ID: ${group.group_id}`), _$1("div", { class: "peer-submeta" }, archived ? "Archived" : "Active"), configuredGroup === group.group_id ? _$1("div", { class: "peer-submeta" }, "This node is configured to use this group for coordinator-backed discovery.") : null, _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Display name"), _$1(TextInput, {
7999
8019
  class: "peer-scope-input",
8000
8020
  disabled: summary.readiness !== "ready" || pending,
8001
8021
  onInput: (event) => {
8002
8022
  groupRenameDrafts.set(group.group_id, String(event.currentTarget.value || ""));
8003
8023
  },
8024
+ type: "text",
8004
8025
  value: draftName
8005
8026
  })), _$1("div", { class: "peer-actions" }, _$1("button", {
8006
8027
  class: "settings-button",
@@ -8118,12 +8139,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
8118
8139
  return _$1("div", {
8119
8140
  class: "peer-card",
8120
8141
  key: deviceId || String(item.fingerprint || "unknown")
8121
- }, _$1("div", { class: "peer-title" }, _$1("strong", null, draft || displayName)), _$1("div", { class: "peer-meta" }, `Device: ${deviceId || "unknown"}`), groupId ? _$1("div", { class: "peer-submeta" }, `Group: ${groupId}`) : null, _$1("div", { class: "peer-submeta" }, enabled ? "Enabled" : "Disabled"), _$1("div", { class: "coordinator-admin-form-grid" }, _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Display name"), _$1("input", {
8142
+ }, _$1("div", { class: "peer-title" }, _$1("strong", null, draft || displayName)), _$1("div", { class: "peer-meta" }, `Device: ${deviceId || "unknown"}`), groupId ? _$1("div", { class: "peer-submeta" }, `Group: ${groupId}`) : null, _$1("div", { class: "peer-submeta" }, enabled ? "Enabled" : "Disabled"), _$1("div", { class: "coordinator-admin-form-grid" }, _$1("label", { class: "coordinator-admin-field" }, _$1("span", null, "Display name"), _$1(TextInput, {
8122
8143
  class: "peer-scope-input",
8123
8144
  disabled: summary.readiness !== "ready" || pending,
8124
8145
  onInput: (event) => {
8125
8146
  deviceRenameDrafts.set(deviceId, String(event.currentTarget.value || ""));
8126
8147
  },
8148
+ type: "text",
8127
8149
  value: draft
8128
8150
  }))), _$1("div", { class: "peer-actions" }, _$1("button", {
8129
8151
  disabled: !deviceId || pending || summary.readiness !== "ready",
@@ -9494,6 +9516,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
9494
9516
  const firstPageKeys = new Set(firstPageItems.map(itemKey));
9495
9517
  return mergeFeedItems(currentItems.filter((item) => !firstPageKeys.has(itemKey(item))), firstPageItems);
9496
9518
  }
9519
+ function syncInspectorQueryDraft(options) {
9520
+ return options.hasInspectorOverride ? options.inspectorQuery : options.feedQuery;
9521
+ }
9522
+ function parseInspectorWorkingSet(value) {
9523
+ return value.split(/\n|,/).map((item) => item.trim()).filter(Boolean);
9524
+ }
9525
+ function packTraceContextKey(options) {
9526
+ return JSON.stringify([
9527
+ options.project,
9528
+ options.query.trim(),
9529
+ options.workingSetFiles
9530
+ ]);
9531
+ }
9497
9532
  function replaceFeedItem(updatedItem) {
9498
9533
  const key = itemKey(updatedItem);
9499
9534
  state.lastFeedItems = state.lastFeedItems.map((item) => itemKey(item) === key ? updatedItem : item);
@@ -10063,19 +10098,34 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10063
10098
  key: `${label}:${candidate.id}`
10064
10099
  }, _$1("div", { className: "feed-card-header" }, [_$1("div", { className: "feed-card-title" }, `${candidate.rank}. ${candidate.title}`), _$1("div", { className: "feed-card-meta" }, `#${candidate.id} · ${candidate.kind}${candidate.section ? ` · ${candidate.section}` : ""}`)]), _$1("div", { className: "feed-card-body" }, [_$1("div", null, candidate.preview || "No preview available."), candidate.reasons.length ? _$1("div", { className: "section-meta" }, `Reasons: ${candidate.reasons.join(", ")}`) : null])))));
10065
10100
  }
10066
- function ContextInspectorPanel() {
10067
- const [open, setOpen] = d(false);
10101
+ function ContextInspectorPanel({ open }) {
10102
+ const [inspectorQuery, setInspectorQuery] = d(() => String(state.feedQuery || ""));
10103
+ const [hasSeededInspectorQuery, setHasSeededInspectorQuery] = d(false);
10104
+ const [hasInspectorOverride, setHasInspectorOverride] = d(false);
10068
10105
  const [workingSetText, setWorkingSetText] = d("");
10069
10106
  const [loading, setLoading] = d(false);
10070
10107
  const [error, setError] = d("");
10071
10108
  const [errorContextKey, setErrorContextKey] = d("");
10072
10109
  const [trace, setTrace] = d(null);
10073
- const currentQuery = String(state.feedQuery || "").trim();
10110
+ const latestTraceRequestId = A$1(0);
10111
+ const feedQuery = String(state.feedQuery || "");
10112
+ const currentQuery = String(inspectorQuery || "").trim();
10074
10113
  const currentProject = state.currentProject || null;
10075
- const currentContextKey = JSON.stringify([currentProject, currentQuery]);
10076
- const visibleTrace = trace && trace.inputs.query === currentQuery && trace.inputs.project === currentProject ? trace : null;
10114
+ const currentWorkingSetFiles = parseInspectorWorkingSet(workingSetText);
10115
+ const currentContextKey = packTraceContextKey({
10116
+ project: currentProject,
10117
+ query: currentQuery,
10118
+ workingSetFiles: currentWorkingSetFiles
10119
+ });
10120
+ const visibleTrace = trace && packTraceContextKey({
10121
+ project: trace.inputs.project,
10122
+ query: trace.inputs.query,
10123
+ workingSetFiles: trace.inputs.working_set_files
10124
+ }) === currentContextKey ? trace : null;
10077
10125
  const visibleError = error && errorContextKey === currentContextKey ? error : "";
10078
10126
  y(() => {
10127
+ latestTraceRequestId.current += 1;
10128
+ setLoading(false);
10079
10129
  setError("");
10080
10130
  setErrorContextKey("");
10081
10131
  setTrace((currentTrace) => {
@@ -10083,11 +10133,34 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10083
10133
  if (currentTrace.inputs.query !== currentQuery || currentTrace.inputs.project !== currentProject) return null;
10084
10134
  return currentTrace;
10085
10135
  });
10086
- }, [currentProject, currentQuery]);
10136
+ }, [currentContextKey]);
10137
+ y(() => {
10138
+ if (open && !hasSeededInspectorQuery) {
10139
+ setInspectorQuery(syncInspectorQueryDraft({
10140
+ feedQuery,
10141
+ hasInspectorOverride,
10142
+ inspectorQuery
10143
+ }));
10144
+ setHasSeededInspectorQuery(true);
10145
+ }
10146
+ }, [
10147
+ feedQuery,
10148
+ hasInspectorOverride,
10149
+ hasSeededInspectorQuery,
10150
+ inspectorQuery,
10151
+ open
10152
+ ]);
10087
10153
  const runTrace = async () => {
10088
10154
  const context = currentQuery;
10089
10155
  const project = currentProject;
10090
- const contextKey = JSON.stringify([project, context]);
10156
+ const workingSetFiles = currentWorkingSetFiles;
10157
+ const contextKey = packTraceContextKey({
10158
+ project,
10159
+ query: context,
10160
+ workingSetFiles
10161
+ });
10162
+ const requestId = latestTraceRequestId.current + 1;
10163
+ latestTraceRequestId.current = requestId;
10091
10164
  if (!context) {
10092
10165
  setError("Enter a query to inspect.");
10093
10166
  setErrorContextKey(contextKey);
@@ -10101,50 +10174,51 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10101
10174
  const nextTrace = await tracePack({
10102
10175
  context,
10103
10176
  project,
10104
- working_set_files: workingSetText.split(/\n|,/).map((value) => value.trim()).filter(Boolean)
10177
+ working_set_files: workingSetFiles
10105
10178
  });
10106
- if (String(state.feedQuery || "").trim() !== context || (state.currentProject || null) !== project) return;
10179
+ if (requestId !== latestTraceRequestId.current) return;
10107
10180
  setTrace(nextTrace);
10108
10181
  } catch (err) {
10109
- if (String(state.feedQuery || "").trim() !== context || (state.currentProject || null) !== project) return;
10182
+ if (requestId !== latestTraceRequestId.current) return;
10110
10183
  setError(err instanceof Error ? err.message : String(err));
10111
10184
  setErrorContextKey(contextKey);
10112
10185
  setTrace(null);
10113
10186
  } finally {
10114
- setLoading(false);
10187
+ if (requestId === latestTraceRequestId.current) setLoading(false);
10115
10188
  }
10116
10189
  };
10117
10190
  const selected = visibleTrace?.retrieval.candidates.filter((candidate) => candidate.disposition === "selected") || [];
10118
10191
  const dropped = visibleTrace?.retrieval.candidates.filter((candidate) => candidate.disposition === "dropped") || [];
10119
10192
  const deduped = visibleTrace?.retrieval.candidates.filter((candidate) => candidate.disposition === "deduped") || [];
10120
10193
  const trimmed = visibleTrace?.retrieval.candidates.filter((candidate) => candidate.disposition === "trimmed") || [];
10121
- return _$1("div", { className: "feed-inspector" }, _$1("button", {
10122
- className: "toggle-button",
10123
- onClick: () => setOpen(!open),
10124
- type: "button"
10125
- }, open ? "Hide Context Inspector" : "Open Context Inspector"), open ? _$1("div", {
10194
+ return open ? _$1("div", { className: "feed-inspector" }, _$1("div", {
10126
10195
  className: "feed-card",
10196
+ id: "contextInspectorPanel",
10127
10197
  style: "margin-top:12px;"
10128
10198
  }, [
10129
- _$1("div", { className: "feed-card-header" }, [_$1("div", { className: "feed-card-title" }, "Context Inspector"), _$1("div", { className: "feed-card-meta" }, "Tracing the current Search query")]),
10199
+ _$1("div", { className: "feed-card-header" }, [_$1("div", { className: "feed-card-title" }, "Context Inspector"), _$1("div", { className: "feed-card-meta" }, hasInspectorOverride ? "Tracing an inspector-specific query" : "Seeded from the feed search on first open")]),
10130
10200
  _$1("div", { className: "feed-card-body" }, [
10131
10201
  _$1("input", {
10132
10202
  className: "feed-search",
10133
10203
  onInput: (event) => {
10134
- state.feedQuery = String(event.currentTarget.value || "");
10204
+ setInspectorQuery(String(event.currentTarget.value || ""));
10205
+ setHasInspectorOverride(true);
10135
10206
  setTrace(null);
10136
10207
  setError("");
10137
10208
  setErrorContextKey("");
10138
- updateFeedView();
10139
10209
  },
10140
10210
  placeholder: "Trace a pack query…",
10141
- value: state.feedQuery
10211
+ value: inspectorQuery
10142
10212
  }),
10213
+ _$1("div", {
10214
+ className: "section-meta",
10215
+ style: "margin-top:8px;"
10216
+ }, hasInspectorOverride ? "Inspector query is independent from the live feed search." : "Inspector query was seeded from the feed search and will stay independent until you change it."),
10143
10217
  _$1("textarea", {
10218
+ className: "feed-inspector-files",
10144
10219
  onInput: (event) => setWorkingSetText(String(event.currentTarget.value || "")),
10145
10220
  placeholder: "Optional working-set files, one per line",
10146
10221
  rows: 3,
10147
- style: "margin-top:8px; width:100%;",
10148
10222
  value: workingSetText
10149
10223
  }),
10150
10224
  _$1("div", { style: "display:flex; gap:8px; margin-top:8px; align-items:center;" }, _$1("button", {
@@ -10156,7 +10230,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10156
10230
  trace && !visibleTrace ? _$1("div", {
10157
10231
  className: "section-meta",
10158
10232
  style: "margin-top:8px;"
10159
- }, "Search context changed. Run trace again for the current query and project.") : null,
10233
+ }, "Trace inputs changed. Run trace again for the current query, project, and working set.") : null,
10160
10234
  visibleError ? _$1("div", {
10161
10235
  className: "section-meta",
10162
10236
  style: "margin-top:8px; color:#d96c6c;"
@@ -10186,9 +10260,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10186
10260
  _$1("pre", { style: "white-space:pre-wrap; overflow:auto;" }, visibleTrace.output.pack_text)
10187
10261
  ])
10188
10262
  ]) : null
10189
- ]) : null);
10263
+ ])) : null;
10190
10264
  }
10191
10265
  function FeedTabView({ items, loadingText }) {
10266
+ const [inspectorOpen, setInspectorOpen] = d(false);
10192
10267
  return _$1(k$2, null, _$1("div", { className: "feed-controls" }, _$1("div", {
10193
10268
  className: "section-meta",
10194
10269
  id: "feedMeta"
@@ -10201,7 +10276,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10201
10276
  },
10202
10277
  placeholder: "Search title, body, tags…",
10203
10278
  value: state.feedQuery
10204
- }), _$1(ContextInspectorPanel, {}), _$1(FeedToggle, {
10279
+ }), _$1(FeedToggle, {
10205
10280
  active: state.feedScopeFilter,
10206
10281
  id: "feedScopeToggle",
10207
10282
  onSelect: (value) => {
@@ -10245,7 +10320,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10245
10320
  label: "Summaries"
10246
10321
  }
10247
10322
  ]
10248
- }))), _$1("div", {
10323
+ }), _$1("button", {
10324
+ "aria-controls": "contextInspectorPanel",
10325
+ "aria-expanded": inspectorOpen,
10326
+ className: "settings-button feed-inspector-button",
10327
+ onClick: () => setInspectorOpen((current) => !current),
10328
+ type: "button"
10329
+ }, inspectorOpen ? "Hide Context Inspector" : "Context Inspector"))), _$1(ContextInspectorPanel, { open: inspectorOpen }), _$1("div", {
10249
10330
  className: "feed-list",
10250
10331
  id: "feedList"
10251
10332
  }, _$1(FeedList, {
@@ -10413,7 +10494,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10413
10494
  if (!container) return;
10414
10495
  J$1(_$1(k$2, null, cards.map((card) => _$1(HealthCard, {
10415
10496
  ...card,
10416
- key: `${card.label}-${card.value}`
10497
+ key: card.key ?? card.label
10417
10498
  }))), container);
10418
10499
  }
10419
10500
  function renderActionList$1(container, actions) {
@@ -10554,6 +10635,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10554
10635
  const isFailed = job.status === "failed";
10555
10636
  const detail = isFailed ? String(job.error || "unknown error").trim() : void 0;
10556
10637
  return buildHealthCard({
10638
+ key: String(job.kind || job.title || "background-maintenance"),
10557
10639
  label: String(job.title || job.kind || "Background maintenance"),
10558
10640
  value: isFailed ? "Failed" : progress,
10559
10641
  detail,
@@ -10564,6 +10646,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10564
10646
  });
10565
10647
  renderHealthCards(healthGrid, [
10566
10648
  buildHealthCard({
10649
+ key: "overall-health",
10567
10650
  label: "Overall health",
10568
10651
  value: statusLabel,
10569
10652
  detail: `Weighted score ${riskScore}`,
@@ -10573,6 +10656,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10573
10656
  }),
10574
10657
  ...maintenanceCards,
10575
10658
  buildHealthCard({
10659
+ key: "pipeline-health",
10576
10660
  label: "Pipeline health",
10577
10661
  value: `${rawPending.toLocaleString()} pending`,
10578
10662
  detail: pipelineDetail,
@@ -10580,6 +10664,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10580
10664
  title: "Raw-event queue pressure and flush reliability"
10581
10665
  }),
10582
10666
  buildHealthCard({
10667
+ key: "retrieval-impact",
10583
10668
  label: "Retrieval impact",
10584
10669
  value: reductionLabel,
10585
10670
  detail: retrievalDetail,
@@ -10587,6 +10672,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10587
10672
  title: "Reduction from memory reuse across recent usage"
10588
10673
  }),
10589
10674
  buildHealthCard({
10675
+ key: "sync-health",
10590
10676
  label: "Sync health",
10591
10677
  value: syncCardValue,
10592
10678
  detail: syncDetail,
@@ -10594,6 +10680,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
10594
10680
  title: "Daemon state and sync recency"
10595
10681
  }),
10596
10682
  buildHealthCard({
10683
+ key: "data-freshness",
10597
10684
  label: "Data freshness",
10598
10685
  value: formatAgeShort(packAgeSeconds),
10599
10686
  detail: freshnessDetail,
@@ -11718,16 +11805,36 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
11718
11805
  updateField(field, value);
11719
11806
  };
11720
11807
  }
11721
- function onCheckboxInput(field) {
11722
- return (event) => {
11723
- updateField(field, event.currentTarget.checked);
11808
+ function onSwitchInput(field) {
11809
+ return (checked) => {
11810
+ updateField(field, checked);
11724
11811
  };
11725
11812
  }
11726
- function onAdvancedToggle(event) {
11727
- const checked = event.currentTarget.checked;
11813
+ function onAdvancedToggle(checked) {
11728
11814
  settingsShowAdvanced = checked;
11729
11815
  settingsController?.setShowAdvanced(checked);
11730
11816
  }
11817
+ function SettingsSwitchRow({ checked, className, disabled = false, hidden = false, id, label, onCheckedChange }) {
11818
+ const labelId = `${id}Label`;
11819
+ return /* @__PURE__ */ u("div", {
11820
+ className: className ? `field-checkbox settings-switch-row ${className}` : "field-checkbox settings-switch-row",
11821
+ hidden,
11822
+ children: [/* @__PURE__ */ u("label", {
11823
+ className: "settings-switch-copy",
11824
+ htmlFor: id,
11825
+ id: labelId,
11826
+ children: label
11827
+ }), /* @__PURE__ */ u(RadixSwitch, {
11828
+ "aria-labelledby": labelId,
11829
+ checked,
11830
+ className: "settings-switch",
11831
+ disabled,
11832
+ id,
11833
+ onCheckedChange,
11834
+ thumbClassName: "settings-switch-thumb"
11835
+ })]
11836
+ });
11837
+ }
11731
11838
  function hiddenUnlessAdvanced() {
11732
11839
  return !settingsShowAdvanced;
11733
11840
  }
@@ -11866,27 +11973,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
11866
11973
  children: "Configure connection, authentication, processing, and sync behavior."
11867
11974
  }),
11868
11975
  /* @__PURE__ */ u("div", {
11869
- className: "settings-advanced-toolbar field-checkbox",
11870
- children: [
11871
- /* @__PURE__ */ u("input", {
11872
- checked: settingsShowAdvanced,
11873
- className: "cm-checkbox",
11874
- id: "settingsAdvancedToggle",
11875
- onChange: onAdvancedToggle,
11876
- type: "checkbox"
11877
- }),
11878
- /* @__PURE__ */ u("label", {
11879
- htmlFor: "settingsAdvancedToggle",
11880
- children: "Show advanced controls"
11881
- }),
11882
- /* @__PURE__ */ u("button", {
11883
- "aria-label": "About advanced controls",
11884
- className: "help-icon",
11885
- "data-tooltip": "Advanced controls include JSON fields, tuning values, and network overrides.",
11886
- type: "button",
11887
- children: "?"
11888
- })
11889
- ]
11976
+ className: "settings-advanced-toolbar",
11977
+ children: [/* @__PURE__ */ u(SettingsSwitchRow, {
11978
+ checked: settingsShowAdvanced,
11979
+ id: "settingsAdvancedToggle",
11980
+ label: "Show advanced controls",
11981
+ onCheckedChange: onAdvancedToggle
11982
+ }), /* @__PURE__ */ u("button", {
11983
+ "aria-label": "About advanced controls",
11984
+ className: "help-icon",
11985
+ "data-tooltip": "Advanced controls include JSON fields, tuning values, and network overrides.",
11986
+ type: "button",
11987
+ children: "?"
11988
+ })]
11890
11989
  }),
11891
11990
  /* @__PURE__ */ u(RadixTabs, {
11892
11991
  ariaLabel: "Settings sections",
@@ -11957,7 +12056,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
11957
12056
  children: "?"
11958
12057
  })]
11959
12058
  }),
11960
- /* @__PURE__ */ u("input", {
12059
+ /* @__PURE__ */ u(TextInput, {
11961
12060
  id: "observerModel",
11962
12061
  onInput: onTextInput("observerModel"),
11963
12062
  placeholder: "leave empty for default",
@@ -12017,7 +12116,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12017
12116
  htmlFor: "claudeCommand",
12018
12117
  children: "Claude command (JSON argv)"
12019
12118
  }),
12020
- /* @__PURE__ */ u("textarea", {
12119
+ /* @__PURE__ */ u(TextArea, {
12021
12120
  disabled: true,
12022
12121
  id: "claudeCommand",
12023
12122
  placeholder: "[\"claude\"]",
@@ -12038,7 +12137,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12038
12137
  htmlFor: "observerMaxChars",
12039
12138
  children: "Request size limit (chars)"
12040
12139
  }),
12041
- /* @__PURE__ */ u("input", {
12140
+ /* @__PURE__ */ u(TextInput, {
12042
12141
  id: "observerMaxChars",
12043
12142
  min: "1",
12044
12143
  onInput: onTextInput("observerMaxChars"),
@@ -12120,7 +12219,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12120
12219
  htmlFor: "observerAuthFile",
12121
12220
  children: "Token file path"
12122
12221
  }),
12123
- /* @__PURE__ */ u("input", {
12222
+ /* @__PURE__ */ u(TextInput, {
12124
12223
  disabled: true,
12125
12224
  id: "observerAuthFile",
12126
12225
  placeholder: "~/.codemem/work-token.txt",
@@ -12149,7 +12248,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12149
12248
  children: "?"
12150
12249
  })]
12151
12250
  }),
12152
- /* @__PURE__ */ u("textarea", {
12251
+ /* @__PURE__ */ u(TextArea, {
12153
12252
  disabled: true,
12154
12253
  id: "observerAuthCommand",
12155
12254
  placeholder: "[\"iap-auth\", \"--audience\", \"gateway\"]",
@@ -12174,7 +12273,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12174
12273
  children: [/* @__PURE__ */ u("label", {
12175
12274
  htmlFor: "observerAuthTimeoutMs",
12176
12275
  children: "Token command timeout (ms)"
12177
- }), /* @__PURE__ */ u("input", {
12276
+ }), /* @__PURE__ */ u(TextInput, {
12178
12277
  id: "observerAuthTimeoutMs",
12179
12278
  min: "1",
12180
12279
  onInput: onTextInput("observerAuthTimeoutMs"),
@@ -12188,7 +12287,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12188
12287
  children: [/* @__PURE__ */ u("label", {
12189
12288
  htmlFor: "observerAuthCacheTtlS",
12190
12289
  children: "Token cache time (s)"
12191
- }), /* @__PURE__ */ u("input", {
12290
+ }), /* @__PURE__ */ u(TextInput, {
12192
12291
  id: "observerAuthCacheTtlS",
12193
12292
  min: "0",
12194
12293
  onInput: onTextInput("observerAuthCacheTtlS"),
@@ -12213,7 +12312,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12213
12312
  children: "?"
12214
12313
  })]
12215
12314
  }),
12216
- /* @__PURE__ */ u("textarea", {
12315
+ /* @__PURE__ */ u(TextArea, {
12217
12316
  disabled: true,
12218
12317
  id: "observerHeaders",
12219
12318
  placeholder: "{\"Authorization\":\"Bearer ${auth.token}\"}",
@@ -12254,7 +12353,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12254
12353
  children: "?"
12255
12354
  })]
12256
12355
  }),
12257
- /* @__PURE__ */ u("input", {
12356
+ /* @__PURE__ */ u(TextInput, {
12258
12357
  id: "rawEventsSweeperIntervalS",
12259
12358
  min: "1",
12260
12359
  onInput: onTextInput("rawEventsSweeperIntervalS"),
@@ -12274,18 +12373,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12274
12373
  className: "settings-group-title",
12275
12374
  children: "Tiered observer routing"
12276
12375
  }),
12277
- /* @__PURE__ */ u("div", {
12278
- className: "field field-checkbox",
12279
- children: [/* @__PURE__ */ u("input", {
12280
- checked: values.observerTierRoutingEnabled,
12281
- className: "cm-checkbox",
12282
- id: "observerTierRoutingEnabled",
12283
- onChange: onCheckboxInput("observerTierRoutingEnabled"),
12284
- type: "checkbox"
12285
- }), /* @__PURE__ */ u("label", {
12286
- htmlFor: "observerTierRoutingEnabled",
12287
- children: "Enable tiered routing"
12288
- })]
12376
+ /* @__PURE__ */ u(SettingsSwitchRow, {
12377
+ checked: values.observerTierRoutingEnabled,
12378
+ className: "field",
12379
+ id: "observerTierRoutingEnabled",
12380
+ label: "Enable tiered routing",
12381
+ onCheckedChange: onSwitchInput("observerTierRoutingEnabled")
12289
12382
  }),
12290
12383
  /* @__PURE__ */ u("div", {
12291
12384
  className: "small",
@@ -12307,7 +12400,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12307
12400
  children: "?"
12308
12401
  })]
12309
12402
  }),
12310
- /* @__PURE__ */ u("input", {
12403
+ /* @__PURE__ */ u(TextInput, {
12311
12404
  id: "observerSimpleModel",
12312
12405
  onInput: onTextInput("observerSimpleModel"),
12313
12406
  placeholder: "leave empty for default",
@@ -12335,7 +12428,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12335
12428
  children: "?"
12336
12429
  })]
12337
12430
  }),
12338
- /* @__PURE__ */ u("input", {
12431
+ /* @__PURE__ */ u(TextInput, {
12339
12432
  id: "observerRichModel",
12340
12433
  onInput: onTextInput("observerRichModel"),
12341
12434
  placeholder: "leave empty for default",
@@ -12347,19 +12440,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12347
12440
  })
12348
12441
  ]
12349
12442
  }),
12350
- /* @__PURE__ */ u(Field, {
12351
- className: "field field-checkbox",
12443
+ /* @__PURE__ */ u(SettingsSwitchRow, {
12444
+ checked: values.observerRichOpenAIUseResponses,
12445
+ className: "field",
12352
12446
  hidden: !showTieredRouting,
12353
- children: [/* @__PURE__ */ u("input", {
12354
- checked: values.observerRichOpenAIUseResponses,
12355
- className: "cm-checkbox",
12356
- id: "observerRichOpenAIUseResponses",
12357
- onChange: onCheckboxInput("observerRichOpenAIUseResponses"),
12358
- type: "checkbox"
12359
- }), /* @__PURE__ */ u("label", {
12360
- htmlFor: "observerRichOpenAIUseResponses",
12361
- children: "Use OpenAI Responses API for rich tier"
12362
- })]
12447
+ id: "observerRichOpenAIUseResponses",
12448
+ label: "Use OpenAI Responses API for rich tier",
12449
+ onCheckedChange: onSwitchInput("observerRichOpenAIUseResponses")
12363
12450
  }),
12364
12451
  /* @__PURE__ */ u(Field, {
12365
12452
  className: "field settings-advanced",
@@ -12367,7 +12454,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12367
12454
  children: [/* @__PURE__ */ u("label", {
12368
12455
  htmlFor: "observerSimpleTemperature",
12369
12456
  children: "Simple tier temperature"
12370
- }), /* @__PURE__ */ u("input", {
12457
+ }), /* @__PURE__ */ u(TextInput, {
12371
12458
  id: "observerSimpleTemperature",
12372
12459
  min: "0",
12373
12460
  onInput: onTextInput("observerSimpleTemperature"),
@@ -12382,7 +12469,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12382
12469
  children: [/* @__PURE__ */ u("label", {
12383
12470
  htmlFor: "observerRichTemperature",
12384
12471
  children: "Rich tier temperature"
12385
- }), /* @__PURE__ */ u("input", {
12472
+ }), /* @__PURE__ */ u(TextInput, {
12386
12473
  id: "observerRichTemperature",
12387
12474
  min: "0",
12388
12475
  onInput: onTextInput("observerRichTemperature"),
@@ -12397,7 +12484,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12397
12484
  children: [/* @__PURE__ */ u("label", {
12398
12485
  htmlFor: "observerRichReasoningEffort",
12399
12486
  children: "Rich tier reasoning effort"
12400
- }), /* @__PURE__ */ u("input", {
12487
+ }), /* @__PURE__ */ u(TextInput, {
12401
12488
  id: "observerRichReasoningEffort",
12402
12489
  onInput: onTextInput("observerRichReasoningEffort"),
12403
12490
  placeholder: "leave empty for default",
@@ -12410,7 +12497,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12410
12497
  children: [/* @__PURE__ */ u("label", {
12411
12498
  htmlFor: "observerRichReasoningSummary",
12412
12499
  children: "Rich tier reasoning summary"
12413
- }), /* @__PURE__ */ u("input", {
12500
+ }), /* @__PURE__ */ u(TextInput, {
12414
12501
  id: "observerRichReasoningSummary",
12415
12502
  onInput: onTextInput("observerRichReasoningSummary"),
12416
12503
  placeholder: "leave empty for default",
@@ -12423,7 +12510,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12423
12510
  children: [/* @__PURE__ */ u("label", {
12424
12511
  htmlFor: "observerRichMaxOutputTokens",
12425
12512
  children: "Rich tier max output tokens"
12426
- }), /* @__PURE__ */ u("input", {
12513
+ }), /* @__PURE__ */ u(TextInput, {
12427
12514
  id: "observerRichMaxOutputTokens",
12428
12515
  min: "1",
12429
12516
  onInput: onTextInput("observerRichMaxOutputTokens"),
@@ -12450,7 +12537,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12450
12537
  htmlFor: "packObservationLimit",
12451
12538
  children: "Observation limit"
12452
12539
  }),
12453
- /* @__PURE__ */ u("input", {
12540
+ /* @__PURE__ */ u(TextInput, {
12454
12541
  id: "packObservationLimit",
12455
12542
  min: "1",
12456
12543
  onInput: onTextInput("packObservationLimit"),
@@ -12471,7 +12558,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12471
12558
  htmlFor: "packSessionLimit",
12472
12559
  children: "Session summary limit"
12473
12560
  }),
12474
- /* @__PURE__ */ u("input", {
12561
+ /* @__PURE__ */ u(TextInput, {
12475
12562
  id: "packSessionLimit",
12476
12563
  min: "1",
12477
12564
  onInput: onTextInput("packSessionLimit"),
@@ -12499,25 +12586,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12499
12586
  className: "settings-group-title",
12500
12587
  children: "Device Sync"
12501
12588
  }),
12502
- /* @__PURE__ */ u("div", {
12503
- className: "field field-checkbox",
12504
- children: [/* @__PURE__ */ u("input", {
12505
- checked: values.syncEnabled,
12506
- className: "cm-checkbox",
12507
- id: "syncEnabled",
12508
- onChange: onCheckboxInput("syncEnabled"),
12509
- type: "checkbox"
12510
- }), /* @__PURE__ */ u("label", {
12511
- htmlFor: "syncEnabled",
12512
- children: "Enable sync"
12513
- })]
12589
+ /* @__PURE__ */ u(SettingsSwitchRow, {
12590
+ checked: values.syncEnabled,
12591
+ className: "field",
12592
+ id: "syncEnabled",
12593
+ label: "Enable sync",
12594
+ onCheckedChange: onSwitchInput("syncEnabled")
12514
12595
  }),
12515
12596
  /* @__PURE__ */ u("div", {
12516
12597
  className: "field",
12517
12598
  children: [/* @__PURE__ */ u("label", {
12518
12599
  htmlFor: "syncInterval",
12519
12600
  children: "Sync interval (seconds)"
12520
- }), /* @__PURE__ */ u("input", {
12601
+ }), /* @__PURE__ */ u(TextInput, {
12521
12602
  id: "syncInterval",
12522
12603
  min: "10",
12523
12604
  onInput: onTextInput("syncInterval"),
@@ -12531,7 +12612,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12531
12612
  children: [/* @__PURE__ */ u("label", {
12532
12613
  htmlFor: "syncHost",
12533
12614
  children: "Sync host"
12534
- }), /* @__PURE__ */ u("input", {
12615
+ }), /* @__PURE__ */ u(TextInput, {
12535
12616
  id: "syncHost",
12536
12617
  onInput: onTextInput("syncHost"),
12537
12618
  placeholder: "127.0.0.1",
@@ -12544,7 +12625,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12544
12625
  children: [/* @__PURE__ */ u("label", {
12545
12626
  htmlFor: "syncPort",
12546
12627
  children: "Sync port"
12547
- }), /* @__PURE__ */ u("input", {
12628
+ }), /* @__PURE__ */ u(TextInput, {
12548
12629
  id: "syncPort",
12549
12630
  min: "1",
12550
12631
  onInput: onTextInput("syncPort"),
@@ -12552,19 +12633,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12552
12633
  value: values.syncPort
12553
12634
  })]
12554
12635
  }),
12555
- /* @__PURE__ */ u("div", {
12556
- className: "field field-checkbox settings-advanced",
12636
+ /* @__PURE__ */ u(SettingsSwitchRow, {
12637
+ checked: values.syncMdns,
12638
+ className: "field settings-advanced",
12557
12639
  hidden: hiddenUnlessAdvanced(),
12558
- children: [/* @__PURE__ */ u("input", {
12559
- checked: values.syncMdns,
12560
- className: "cm-checkbox",
12561
- id: "syncMdns",
12562
- onChange: onCheckboxInput("syncMdns"),
12563
- type: "checkbox"
12564
- }), /* @__PURE__ */ u("label", {
12565
- htmlFor: "syncMdns",
12566
- children: "Enable mDNS discovery"
12567
- })]
12640
+ id: "syncMdns",
12641
+ label: "Enable mDNS discovery",
12642
+ onCheckedChange: onSwitchInput("syncMdns")
12568
12643
  }),
12569
12644
  /* @__PURE__ */ u("div", {
12570
12645
  className: "field",
@@ -12573,7 +12648,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12573
12648
  htmlFor: "syncCoordinatorUrl",
12574
12649
  children: "Coordinator URL"
12575
12650
  }),
12576
- /* @__PURE__ */ u("input", {
12651
+ /* @__PURE__ */ u(TextInput, {
12577
12652
  disabled: true,
12578
12653
  id: "syncCoordinatorUrl",
12579
12654
  placeholder: "https://coord.example.com",
@@ -12592,7 +12667,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12592
12667
  htmlFor: "syncCoordinatorGroup",
12593
12668
  children: "Coordinator group"
12594
12669
  }),
12595
- /* @__PURE__ */ u("input", {
12670
+ /* @__PURE__ */ u(TextInput, {
12596
12671
  id: "syncCoordinatorGroup",
12597
12672
  onInput: onTextInput("syncCoordinatorGroup"),
12598
12673
  placeholder: "team-alpha",
@@ -12610,7 +12685,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12610
12685
  children: [/* @__PURE__ */ u("label", {
12611
12686
  htmlFor: "syncCoordinatorTimeout",
12612
12687
  children: "Coordinator timeout (seconds)"
12613
- }), /* @__PURE__ */ u("input", {
12688
+ }), /* @__PURE__ */ u(TextInput, {
12614
12689
  id: "syncCoordinatorTimeout",
12615
12690
  min: "1",
12616
12691
  onInput: onTextInput("syncCoordinatorTimeout"),
@@ -12624,7 +12699,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12624
12699
  children: [/* @__PURE__ */ u("label", {
12625
12700
  htmlFor: "syncCoordinatorPresenceTtl",
12626
12701
  children: "Presence TTL (seconds)"
12627
- }), /* @__PURE__ */ u("input", {
12702
+ }), /* @__PURE__ */ u(TextInput, {
12628
12703
  id: "syncCoordinatorPresenceTtl",
12629
12704
  min: "1",
12630
12705
  onInput: onTextInput("syncCoordinatorPresenceTtl"),
@@ -12716,8 +12791,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12716
12791
  })
12717
12792
  }, `${item.label}-${index}`)) });
12718
12793
  }
12719
- function AttemptsList({ attempts }) {
12720
- return /* @__PURE__ */ u(k$2, { children: attempts.map((attempt, index) => /* @__PURE__ */ u("div", {
12794
+ function AttemptsList({ attempts, note }) {
12795
+ return /* @__PURE__ */ u(k$2, { children: [note ? /* @__PURE__ */ u("div", {
12796
+ class: "small",
12797
+ children: note
12798
+ }) : null, attempts.map((attempt, index) => /* @__PURE__ */ u("div", {
12721
12799
  class: "diag-line",
12722
12800
  children: [/* @__PURE__ */ u("div", {
12723
12801
  class: "left",
@@ -12733,7 +12811,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12733
12811
  class: "right",
12734
12812
  children: attempt.startedAt
12735
12813
  })]
12736
- }, `${attempt.startedAt}-${attempt.peerLabel}-${index}`)) });
12814
+ }, `${attempt.startedAt}-${attempt.peerLabel}-${index}`))] });
12737
12815
  }
12738
12816
  function PairingText({ text }) {
12739
12817
  return /* @__PURE__ */ u(k$2, { children: text });
@@ -12751,12 +12829,15 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12751
12829
  }
12752
12830
  renderIntoSyncMount(mount, /* @__PURE__ */ u(DiagnosticsGrid, { items }));
12753
12831
  }
12754
- function renderAttemptsList(mount, attempts) {
12832
+ function renderAttemptsList(mount, attempts, note) {
12755
12833
  if (!attempts.length) {
12756
12834
  clearSyncMount(mount);
12757
12835
  return;
12758
12836
  }
12759
- renderIntoSyncMount(mount, /* @__PURE__ */ u(AttemptsList, { attempts }));
12837
+ renderIntoSyncMount(mount, /* @__PURE__ */ u(AttemptsList, {
12838
+ attempts,
12839
+ note
12840
+ }));
12760
12841
  }
12761
12842
  function renderSyncEmptyState(mount, view) {
12762
12843
  renderIntoSyncMount(mount, /* @__PURE__ */ u(SyncEmptyState, { ...view }));
@@ -12951,10 +13032,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12951
13032
  className: "sr-only",
12952
13033
  children: "Team name"
12953
13034
  }),
12954
- /* @__PURE__ */ u("input", {
13035
+ /* @__PURE__ */ u(TextInput, {
12955
13036
  className: "peer-scope-input",
12956
13037
  id: "syncInviteGroup",
12957
- placeholder: "Team name (e.g. my-team)"
13038
+ placeholder: "Team name (e.g. my-team)",
13039
+ type: "text"
12958
13040
  }),
12959
13041
  /* @__PURE__ */ u("label", {
12960
13042
  htmlFor: "syncInvitePolicy",
@@ -12972,7 +13054,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12972
13054
  htmlFor: "syncInviteTtl",
12973
13055
  children: "Expires in"
12974
13056
  }),
12975
- /* @__PURE__ */ u("input", {
13057
+ /* @__PURE__ */ u(TextInput, {
12976
13058
  className: "peer-scope-input",
12977
13059
  defaultValue: "24",
12978
13060
  id: "syncInviteTtl",
@@ -12996,7 +13078,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
12996
13078
  className: "sr-only",
12997
13079
  children: "Generated invite"
12998
13080
  }),
12999
- /* @__PURE__ */ u("textarea", {
13081
+ /* @__PURE__ */ u(TextArea, {
13000
13082
  className: "feed-search",
13001
13083
  id: "syncInviteOutput",
13002
13084
  placeholder: "Invite will appear here",
@@ -13146,7 +13228,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
13146
13228
  };
13147
13229
  }
13148
13230
  function deriveCoordinatorApprovalSummary(input) {
13149
- if (Boolean(input.device?.needs_local_approval) && !input.pairedLocally) return {
13231
+ if (input.device?.needs_local_approval) return {
13150
13232
  state: "needs-your-approval",
13151
13233
  badgeLabel: "Needs your approval",
13152
13234
  description: "Another device already trusted this one. Approve it on this device to finish reciprocal onboarding.",
@@ -13165,6 +13247,15 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
13165
13247
  actionLabel: null
13166
13248
  };
13167
13249
  }
13250
+ function shouldShowCoordinatorReviewAction(input) {
13251
+ const approvalSummary = deriveCoordinatorApprovalSummary(input);
13252
+ const deviceId = cleanText(input.device?.device_id);
13253
+ const fingerprint = cleanText(input.device?.fingerprint);
13254
+ if (!deviceId || !fingerprint) return false;
13255
+ if (Boolean(input.device?.stale) || Boolean(input.hasAmbiguousCoordinatorGroup)) return false;
13256
+ if (!input.pairedLocally) return true;
13257
+ return approvalSummary.state === "needs-your-approval";
13258
+ }
13168
13259
  function summarizeSyncRunResult(payload) {
13169
13260
  const items = Array.isArray(payload?.items) ? payload.items : [];
13170
13261
  if (!items.length) return {
@@ -13820,10 +13911,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
13820
13911
  const syncAttempts = document.getElementById("syncAttempts");
13821
13912
  if (!syncAttempts) return;
13822
13913
  const attempts = state.lastSyncAttempts;
13914
+ const daemonState = String(state.lastSyncStatus?.daemon_state || "").trim();
13823
13915
  if (!Array.isArray(attempts) || !attempts.length) {
13824
13916
  renderSyncEmptyState(syncAttempts, noAttemptsState());
13825
13917
  return;
13826
13918
  }
13919
+ const historyOnlyNote = syncAttemptsHistoryNote(daemonState, attempts.slice(0, 5).some((attempt) => attempt.status === "error"));
13827
13920
  renderAttemptsList(syncAttempts, attempts.slice(0, 5).map((attempt) => {
13828
13921
  const time = attempt.started_at || attempt.started_at_utc || "";
13829
13922
  const peerId = String(attempt.peer_device_id || "").trim();
@@ -13840,7 +13933,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
13840
13933
  detail: detailParts.join(" · "),
13841
13934
  startedAt: time ? formatTimestamp(time) : ""
13842
13935
  };
13843
- }));
13936
+ }), historyOnlyNote);
13937
+ }
13938
+ function syncAttemptsHistoryNote(daemonState, hasVisibleErrors) {
13939
+ return daemonState === "offline-peers" && hasVisibleErrors ? "Some recent failures may have happened before all peers went offline. Sync will resume automatically when a peer becomes reachable." : "";
13844
13940
  }
13845
13941
  function renderSyncDiagnosticsUnavailable() {
13846
13942
  const syncStatusGrid = document.getElementById("syncStatusGrid");
@@ -14049,10 +14145,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14049
14145
  className: "peer-meta",
14050
14146
  children: "Rename in config"
14051
14147
  }) : /* @__PURE__ */ u(k$2, { children: [
14052
- /* @__PURE__ */ u("input", {
14148
+ /* @__PURE__ */ u(TextInput, {
14053
14149
  "aria-label": `Rename ${label}`,
14054
14150
  className: "peer-scope-input actor-name-input",
14055
14151
  disabled: renameBusy || mergeBusy,
14152
+ type: "text",
14056
14153
  value: name,
14057
14154
  onInput: (event) => setName(event.currentTarget.value)
14058
14155
  }),
@@ -14451,12 +14548,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
14451
14548
  }), /* @__PURE__ */ u("div", {
14452
14549
  className: "peer-actions",
14453
14550
  children: [
14454
- /* @__PURE__ */ u("input", {
14551
+ /* @__PURE__ */ u(TextInput, {
14455
14552
  "aria-label": `Friendly name for ${displayName}`,
14456
14553
  className: "peer-scope-input",
14457
14554
  "data-device-name-input": peerId || void 0,
14458
14555
  disabled: renameBusy,
14459
14556
  placeholder: "Friendly device name",
14557
+ type: "text",
14460
14558
  value: renameValue,
14461
14559
  onInput: (event) => setRenameValue(event.currentTarget.value)
14462
14560
  }),
@@ -15635,7 +15733,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
15635
15733
  });
15636
15734
  const pairedFingerprint = String(pairedPeer?.fingerprint || "").trim();
15637
15735
  const hasConflict = Boolean(pairedPeer) && Boolean(fingerprint) && Boolean(pairedFingerprint) && pairedFingerprint !== fingerprint;
15638
- const canAccept = Boolean(deviceId) && Boolean(fingerprint) && !pairedPeer && !device.stale && !hasAmbiguousCoordinatorGroup;
15736
+ const canAccept = shouldShowCoordinatorReviewAction({
15737
+ device,
15738
+ hasAmbiguousCoordinatorGroup,
15739
+ pairedLocally: Boolean(pairedPeer)
15740
+ });
15639
15741
  const addresses = Array.isArray(device.addresses) ? device.addresses : [];
15640
15742
  const noteParts = [addresses.length ? addresses.map((address) => isSyncRedactionEnabled() ? redactAddress(String(address || "")) : String(address || "")).filter(Boolean).join(" · ") : "No fresh addresses"];
15641
15743
  if (!addresses.length && displayTitle) noteParts.push(`device id: ${deviceId}`);
@@ -15651,14 +15753,14 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
15651
15753
  mode = "scope-pending";
15652
15754
  } else if (pairedPeer?.last_error) {
15653
15755
  noteParts.push(`error: ${String(pairedPeer.last_error)}`);
15654
- mode = "paired";
15756
+ if (!canAccept) mode = "paired";
15655
15757
  } else if (pairedPeer?.status?.peer_state) {
15656
15758
  noteParts.push(`status: ${String(pairedPeer.status.peer_state)}`);
15657
- mode = "paired";
15759
+ if (!canAccept) mode = "paired";
15658
15760
  } else if (!pairedPeer && device.stale) {
15659
15761
  actionMessage = "Wait for a fresh coordinator presence update, then review this device again here.";
15660
15762
  mode = "stale";
15661
- } else if (pairedPeer) mode = "paired";
15763
+ } else if (pairedPeer && !canAccept) mode = "paired";
15662
15764
  if (mode === "paired") pairedMessage = approvalSummary.state === "waiting-for-other-device" ? approvalSummary.description || "Waiting on the other device." : String(pairedPeer?.last_error || "").toLowerCase().includes("401") && String(pairedPeer?.last_error || "").toLowerCase().includes("unauthorized") ? "Waiting for the other device to trust this one before sync can work." : null;
15663
15765
  return {
15664
15766
  actionMessage,
@@ -16119,7 +16221,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16119
16221
  try {
16120
16222
  const runtime = await loadRuntimeInfo();
16121
16223
  if (!runtime?.version) return;
16122
- setRuntimeLabel(runtime.version, "724f6d5");
16224
+ setRuntimeLabel(runtime.version, "6a10199");
16123
16225
  } catch {}
16124
16226
  }
16125
16227
  var lastAnnouncedRefreshState = null;
@@ -16225,31 +16327,32 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16225
16327
  refresh();
16226
16328
  }
16227
16329
  });
16228
- var TAB_IDS = [
16229
- "feed",
16230
- "health",
16231
- "sync",
16232
- "coordinator-admin"
16233
- ];
16234
- function switchTab(tab) {
16235
- setActiveTab(tab);
16236
- TAB_IDS.forEach((id) => {
16330
+ function renderTabs(activeTab) {
16331
+ const visibleTabs = new Set(getVisibleTabs(state.lastCoordinatorAdminStatus));
16332
+ ALL_TAB_IDS.forEach((id) => {
16237
16333
  const panel = $$2(`tab-${id}`);
16238
- if (panel) panel.hidden = id !== tab;
16334
+ if (panel) panel.hidden = id !== activeTab || !visibleTabs.has(id);
16239
16335
  });
16240
- TAB_IDS.forEach((id) => {
16336
+ ALL_TAB_IDS.forEach((id) => {
16241
16337
  const btn = $$2(`tabBtn-${id}`);
16242
- if (btn) btn.classList.toggle("active", id === tab);
16338
+ if (!btn) return;
16339
+ btn.hidden = !visibleTabs.has(id);
16340
+ btn.classList.toggle("active", id === activeTab && visibleTabs.has(id));
16243
16341
  });
16342
+ }
16343
+ function switchTab(tab) {
16344
+ const nextTab = resolveAccessibleTab(tab, state.lastCoordinatorAdminStatus);
16345
+ setActiveTab(nextTab);
16346
+ renderTabs(nextTab);
16244
16347
  refresh();
16245
16348
  }
16246
16349
  function initTabs() {
16247
- TAB_IDS.forEach((id) => {
16350
+ ALL_TAB_IDS.forEach((id) => {
16248
16351
  $$2(`tabBtn-${id}`)?.addEventListener("click", () => switchTab(id));
16249
16352
  });
16250
16353
  window.addEventListener("hashchange", () => {
16251
16354
  const hash = window.location.hash.replace("#", "");
16252
- if (TAB_IDS.includes(hash) && hash !== state.activeTab) switchTab(hash);
16355
+ if (ALL_TAB_IDS.includes(hash) && hash !== state.activeTab) switchTab(hash);
16253
16356
  });
16254
16357
  switchTab(state.activeTab);
16255
16358
  }
@@ -16291,12 +16394,35 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
16291
16394
  state.refreshInFlight = true;
16292
16395
  try {
16293
16396
  setRefreshStatus("refreshing");
16397
+ let refreshTab = state.activeTab;
16398
+ if (refreshTab === "coordinator-admin") {
16399
+ try {
16400
+ const status = await loadCoordinatorAdminStatus();
16401
+ state.lastCoordinatorAdminStatus = status && typeof status === "object" ? status : null;
16402
+ } catch {
16403
+ state.lastCoordinatorAdminStatus = null;
16404
+ }
16405
+ refreshTab = state.activeTab;
16406
+ refreshTab = resolveAccessibleTab(refreshTab, state.lastCoordinatorAdminStatus);
16407
+ if (refreshTab !== state.activeTab) {
16408
+ setActiveTab(refreshTab);
16409
+ renderTabs(refreshTab);
16410
+ }
16411
+ }
16294
16412
  const promises = [loadHealthData(), loadConfigData()];
16295
- if (state.activeTab === "feed") promises.push(loadFeedData());
16296
- if (state.activeTab === "sync" || state.activeTab === "health") promises.push(loadSyncData());
16297
- if (state.activeTab === "coordinator-admin") promises.push(loadCoordinatorAdminData());
16413
+ if (refreshTab === "feed") promises.push(loadCoordinatorAdminStatus().then((status) => {
16414
+ state.lastCoordinatorAdminStatus = status && typeof status === "object" ? status : null;
16415
+ }).catch(() => {
16416
+ state.lastCoordinatorAdminStatus = null;
16417
+ }));
16418
+ if (refreshTab === "feed") promises.push(loadFeedData());
16419
+ if (refreshTab === "sync" || refreshTab === "health") promises.push(loadSyncData());
16420
+ if (refreshTab === "coordinator-admin") promises.push(loadCoordinatorAdminData());
16298
16421
  if (state.syncPairingOpen) promises.push(loadPairingData());
16299
16422
  await Promise.all(promises);
16423
+ const nextTab = resolveAccessibleTab(state.activeTab, state.lastCoordinatorAdminStatus);
16424
+ if (nextTab !== state.activeTab) setActiveTab(nextTab);
16425
+ renderTabs(state.activeTab);
16300
16426
  setRefreshStatus("idle");
16301
16427
  } catch {
16302
16428
  if (!await isViewerReady()) scheduleReconnectLoop();