clearotron 0.5.1-beta.0 → 0.5.1-beta.2

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.
@@ -139,6 +139,25 @@ function applyUnit(unitText, readEnvFile, home) {
139
139
  return { env: { ...env, ...fromFiles }, missing };
140
140
  }
141
141
 
142
+ /**
143
+ * The files a unit's `EnvironmentFile=` lines name, resolved as `applyUnit` resolves them (`%h` is `home`, and a
144
+ * leading `-` only marks the file optional), in the order listed. Null when a path cannot be resolved: then what
145
+ * the unit reads is not known, and naming one of its files would be a guess. PURE.
146
+ */
147
+ export function environmentFilesOf(unitText, home) {
148
+ const out = [];
149
+ for (const raw of String(unitText ?? "").split("\n")) {
150
+ const file = /^EnvironmentFile=(.*)$/.exec(raw.trim());
151
+ if (!file) continue;
152
+ let spec = file[1].trim();
153
+ if (spec.startsWith(OPTIONAL)) spec = spec.slice(1);
154
+ const resolved = expandSpecifiers(spec, home);
155
+ if (resolved.unresolved !== undefined) return null;
156
+ out.push(resolved.path);
157
+ }
158
+ return out;
159
+ }
160
+
142
161
  /**
143
162
  * The environment the units actually run with.
144
163
  *
@@ -1,5 +1,13 @@
1
1
  # trademark-artifacts-mcp
2
2
 
3
+ ## 0.5.1-beta.2
4
+
5
+ No changes in this release.
6
+
7
+ ## 0.5.1-beta.1
8
+
9
+ No changes in this release.
10
+
3
11
  ## 0.5.1-beta.0
4
12
 
5
13
  No changes in this release.
@@ -9,6 +9,7 @@
9
9
  import { readdirSync, readFileSync, existsSync } from "node:fs";
10
10
  import { join } from "node:path";
11
11
  import { DRIVER_DIR, driverDir } from "../../shared/driver-dir.mjs"; //
12
+ import { channelPackage } from "../../shared/permanent-install.mjs"; // — the check a reader is sent to, on this install's channel
12
13
  import { config, paths, reportIdentityFor } from "./driver.mjs";
13
14
 
14
15
  // Mirror of progress.mjs SKIP_DIRS — the high-churn leaf dirs that never hold a run-level status.json.
@@ -58,16 +59,20 @@ export function tierFromRecord(runDir) {
58
59
  } catch { return null; }
59
60
  }
60
61
 
62
+ // THE CHECK BOTH SENTENCES SEND A READER TO, ON THIS INSTALL'S CHANNEL. `npx clearotron doctor` fetches the
63
+ // stable, which on a beta reads the beta's install with the other channel's code.
64
+ const DOCTOR = `\`npx ${channelPackage()} doctor\``;
65
+
61
66
  export function unreadableRunsReason({ workSet, workRoot, workExists, poolSet, workReadError = null }) {
62
67
  // A work folder that was named and is not there, or cannot be read, is said, never listed as empty.
63
68
  if (workSet && workReadError) {
64
69
  return `no searches can be read here: CLEAROTRON_WORK_DIR is ${workRoot}, which `
65
70
  + (workReadError === "ENOENT" ? "does not exist. " : `cannot be read (${workReadError}). `)
66
- + "`npx clearotron doctor` prints where an install keeps them.";
71
+ + `${DOCTOR} prints where an install keeps them.`;
67
72
  }
68
73
  if (workSet || workExists || poolSet) return null;
69
74
  return `no searches can be read here: CLEAROTRON_WORK_DIR is unset and ${workRoot} does not exist, `
70
- + "and CLEAROTRON_REPORTS_DIR is unset. Set them to the install's directories — `npx clearotron doctor` "
75
+ + `and CLEAROTRON_REPORTS_DIR is unset. Set them to the install's directories — ${DOCTOR} `
71
76
  + "prints where an install keeps them, and mcp-server/CONNECT.md says how to connect this server.";
72
77
  }
73
78
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trademark-artifacts-mcp",
3
- "version": "0.5.1-beta.0",
3
+ "version": "0.5.1-beta.2",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": true,
6
6
  "description": "MCP server to interrogate clearotron trademark-clearance runs — list/read artifacts, trace the full decision flow, telemetry/cost, coverage, single-run search, and a gated single-step what-if. Imports the clearotron-driver read-only; touches no driver/template/deploy files.",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "clearotron",
3
3
  "mcpName": "io.github.CordilleraSarl/clearotron",
4
4
  "type": "module",
5
- "version": "0.5.1-beta.0",
5
+ "version": "0.5.1-beta.2",
6
6
  "license": "AGPL-3.0-only",
7
7
  "repository": {
8
8
  "type": "git",
@@ -11445,6 +11445,7 @@ function runKey(run) {
11445
11445
  }
11446
11446
  // src/contract/api.ts
11447
11447
  var isOk = (r) => r.kind === "ok";
11448
+ var companyRead = (needsOwner, read) => needsOwner ? Promise.resolve({ kind: "pickAccount" }) : read();
11448
11449
  function saveFailureText(r, fallback = "That change could not be saved.") {
11449
11450
  switch (r.kind) {
11450
11451
  case "ok": return fallback;
@@ -11864,6 +11865,7 @@ var api = {
11864
11865
  canSearch: b["canSearch"] !== false,
11865
11866
  searchRefusal: b["canSearch"] === false && typeof b["searchRefusal"] === "string" ? b["searchRefusal"] : null,
11866
11867
  setupRoute: b["setupRoute"] === "packaged" ? "packaged" : b["setupRoute"] === "checkout" ? "checkout" : null,
11868
+ channel: b["channel"] === "beta" ? "beta" : b["channel"] === "latest" ? "latest" : null,
11867
11869
  brand: typeof b["brand"] === "string" ? b["brand"] : "",
11868
11870
  administratorContact: typeof b["administratorContact"] === "string" && /^(mailto:[^\s]+@|https?:\/\/[^\s])/i.test(b["administratorContact"]) ? b["administratorContact"] : null,
11869
11871
  stopControl: (() => {
@@ -14774,7 +14776,9 @@ function chooseProduct(d, product) {
14774
14776
  nativeLanguage: nativeLanguageControl(product) === "toggle" ? d.nativeLanguage : false
14775
14777
  };
14776
14778
  }
14777
- function recommendSearch(products, names, territories) {
14779
+ var TIER_OF_CODE = Object.freeze(Object.fromEntries([...offered_territories_default.regions.map((t) => [t.code, "region"]), ...offered_territories_default.countries.map((t) => [t.code, "country"])]));
14780
+ var tierOfPlace = (place) => tierOf(place) ?? TIER_OF_CODE[territoryKeyOf(place)] ?? null;
14781
+ function recommendSearch(products, names, territories, { own = false } = {}) {
14778
14782
  if (territories.length === 0 && names <= 1) return null;
14779
14783
  const live = products.filter((p) => p.available);
14780
14784
  if (names > 1) {
@@ -14784,15 +14788,17 @@ function recommendSearch(products, names, territories) {
14784
14788
  reason: `because you entered ${names} names`
14785
14789
  } : null;
14786
14790
  }
14787
- const regions = territories.filter((t) => tierOf(t) === "region").length;
14788
- const countries = territories.filter((t) => tierOf(t) === "country").length;
14791
+ const regions = territories.filter((t) => tierOfPlace(t) === "region").length;
14792
+ const countries = territories.filter((t) => tierOfPlace(t) === "country").length;
14793
+ if (!regions && !countries) return null;
14789
14794
  const geography = territories.length === 1 && countries === 1 ? "exactly one country" : "a region, or two or more countries";
14790
14795
  const product = live.find((p) => p.pipeline !== "knockout" && p.geography === geography);
14791
14796
  if (!product) return null;
14792
14797
  const some = (n, one, many) => n === 1 ? `a ${one}` : `${n} ${many}`;
14798
+ const named = [regions ? some(regions, "region", "regions") : "", countries ? some(countries, "country", "countries") : ""].filter(Boolean);
14793
14799
  return {
14794
14800
  product,
14795
- reason: `because you named ${[regions ? some(regions, "region", "regions") : "", countries ? some(countries, "country", "countries") : ""].filter(Boolean).join(" and ")}`
14801
+ reason: own ? `because the company searches ${named.join(" and ")}` : `because you named ${named.join(" and ")}`
14796
14802
  };
14797
14803
  }
14798
14804
  function templateLine(label, product) {
@@ -18878,7 +18884,7 @@ function Missing({ go, reason }) {
18878
18884
  });
18879
18885
  }
18880
18886
  // src/contract/engineState.ts
18881
- var SETUP_COMMAND = "`npx clearotron install`";
18887
+ var setupPackage = (channel) => channel === "beta" ? "clearotron@beta" : "clearotron";
18882
18888
  var NO_ENGINE = "No search engine is attached to this install.";
18883
18889
  var listed = (xs, and = "and") => xs.length <= 1 ? xs[0] ?? "" : `${xs.slice(0, -1).join(", ")} ${and} ${xs[xs.length - 1]}`;
18884
18890
  var PAID_BY = {
@@ -18919,14 +18925,14 @@ function billingRefusalSentence(r) {
18919
18925
  default: return generic;
18920
18926
  }
18921
18927
  }
18922
- function engineRowFaults(engine, { programDisputed = false } = {}) {
18928
+ function engineRowFaults(engine, { programDisputed = false, channel = null } = {}) {
18923
18929
  const reason = engine.billing.reason ?? null;
18924
18930
  if (engine.selected === false) return [NO_ENGINE];
18925
18931
  return [
18926
18932
  ...engine.known ? [] : [`This build does not ship an engine called ${engine.id}.`],
18927
18933
  ...engine.billing.missing.length ? ["Set to bill an API key, and no key is set — a run is refused rather than billed to the subscription."] : [],
18928
18934
  ...reason && !engine.billing.missing.length ? [billingRefusalSentence(reason)] : [],
18929
- ...engine.binaryPresent ? [] : engine.program ? [`The engine program \`${engine.program}\` cannot be found or run on this machine. Run the setup wizard, ${SETUP_COMMAND}: it offers to install the program and proves it with one turn. Then restart Clearotron's services, which look for the program when they start.`] : ["The engine program cannot be found or run on this machine."],
18935
+ ...engine.binaryPresent ? [] : engine.program ? [`The engine program \`${engine.program}\` cannot be found or run on this machine. Run the setup wizard, \`npx ${setupPackage(channel)} install\`: it offers to install the program and proves it with one turn. Then restart Clearotron's services, which look for the program when they start.`] : ["The engine program cannot be found or run on this machine."],
18930
18936
  ...programDisputed && engine.binaryPresent ? [`The engine program is on this machine, but the engine could not find it when it last started — so a new search will refuse. Restart the engine service so it looks again. If it still cannot find it, set ${engine.programSetting ?? "the engine's program setting"} to the program's full path in the settings file the service reads, then restart it again.`] : []
18931
18937
  ];
18932
18938
  }
@@ -18946,8 +18952,11 @@ function engineNotice({ programDisputed }) {
18946
18952
  after: "Then restart the service: this reading was taken when it started, and it will not notice a new install until it starts again."
18947
18953
  };
18948
18954
  }
18949
- function engineRow(engine, { programDisputed = false } = {}) {
18950
- const faults = engineRowFaults(engine, { programDisputed });
18955
+ function engineRow(engine, { programDisputed = false, channel = null } = {}) {
18956
+ const faults = engineRowFaults(engine, {
18957
+ programDisputed,
18958
+ channel
18959
+ });
18951
18960
  if (engine.selected === false) return {
18952
18961
  ok: false,
18953
18962
  name: "Not set",
@@ -19421,10 +19430,10 @@ var EMPTY = {
19421
19430
  function NewClearance({ ctx }) {
19422
19431
  const account = ctx.owner;
19423
19432
  const needsOwner = ctx.me.allAccounts && account === null;
19424
- const { result: searches, reload: retrySearches } = useLoad(() => api.searches(account), [account]);
19425
- const { result: profileRes } = useLoad(() => api.profile(account), [account]);
19426
- const { result: projectsRes } = useLoad(() => api.projects(account), [account]);
19427
- const { result: usageRes } = useLoad(() => api.usage(account), [account]);
19433
+ const { result: searches, reload: retrySearches } = useLoad(() => companyRead(needsOwner, () => api.searches(account)), [account, needsOwner]);
19434
+ const { result: profileRes } = useLoad(() => companyRead(needsOwner, () => api.profile(account)), [account, needsOwner]);
19435
+ const { result: projectsRes } = useLoad(() => companyRead(needsOwner, () => api.projects(account)), [account, needsOwner]);
19436
+ const { result: usageRes } = useLoad(() => companyRead(needsOwner, () => api.usage(account)), [account, needsOwner]);
19428
19437
  const levels = searches?.kind === "ok" ? searches.value.products : [];
19429
19438
  const registerTerritories = searches?.kind === "ok" ? searches.value.registerTerritories : void 0;
19430
19439
  const registerLabel = searches?.kind === "ok" ? searches.value.registerLabel : void 0;
@@ -19453,6 +19462,7 @@ function NewClearance({ ctx }) {
19453
19462
  const [problem, setProblem] = (0, import_react.useState)(null);
19454
19463
  const [submitted, setSubmitted] = (0, import_react.useState)(null);
19455
19464
  const [savedDraft, setSavedDraft] = (0, import_react.useState)(null);
19465
+ const [landed, setLanded] = (0, import_react.useState)(null);
19456
19466
  const [leaveTo, setLeaveTo] = (0, import_react.useState)(null);
19457
19467
  (0, import_react.useEffect)(() => {
19458
19468
  if (leaveTo) ctx.go(leaveTo);
@@ -19461,11 +19471,12 @@ function NewClearance({ ctx }) {
19461
19471
  current: JSON.stringify(draft),
19462
19472
  empty: JSON.stringify(EMPTY),
19463
19473
  saved: savedDraft,
19464
- submitted: submitted != null
19474
+ submitted: submitted != null || landed != null
19465
19475
  }), [
19466
19476
  draft,
19467
19477
  submitted,
19468
- savedDraft
19478
+ savedDraft,
19479
+ landed
19469
19480
  ]));
19470
19481
  const { result: projectRes } = useLoad(() => draft.project ? api.project(account, draft.project) : Promise.resolve({
19471
19482
  kind: "ok",
@@ -19545,7 +19556,7 @@ function NewClearance({ ctx }) {
19545
19556
  setSaveNote(null);
19546
19557
  };
19547
19558
  const setPick = (next) => edit({ pick: next });
19548
- const recommendation = (0, import_react.useMemo)(() => recommendSearch(levels, names.length, draft.pick.territories.length ? draft.pick.territories : own.territories), [
19559
+ const recommendation = (0, import_react.useMemo)(() => draft.pick.territories.length ? recommendSearch(levels, names.length, draft.pick.territories) : recommendSearch(levels, names.length, own.territories, { own: true }), [
19549
19560
  levels,
19550
19561
  names.length,
19551
19562
  draft.pick.territories,
@@ -19586,7 +19597,7 @@ function NewClearance({ ctx }) {
19586
19597
  deadline: d.deadline
19587
19598
  };
19588
19599
  let after = applyRead(before, read, own.classes, { worldwide });
19589
- const fits = recommendSearch(levels, parseNames(after.names).length, after.draft.territories.length ? after.draft.territories : own.territories);
19600
+ const fits = after.draft.territories.length ? recommendSearch(levels, parseNames(after.names).length, after.draft.territories) : recommendSearch(levels, parseNames(after.names).length, own.territories, { own: true });
19590
19601
  if (read.product == null && !pickedByHand && !d.savedSearch && fits) after = {
19591
19602
  ...after,
19592
19603
  draft: chooseProduct(after.draft, fits.product)
@@ -19700,7 +19711,8 @@ function NewClearance({ ctx }) {
19700
19711
  if (r.value.landedOn) {
19701
19712
  setPlan(null);
19702
19713
  setRunFailure(null);
19703
- ctx.go(`/portal/result/${encodeURIComponent(r.value.landedOn)}`);
19714
+ setLanded(r.value.landedOn);
19715
+ setLeaveTo(`/portal/result/${encodeURIComponent(r.value.landedOn)}`);
19704
19716
  return;
19705
19717
  }
19706
19718
  setSubmitted(r.value.id);
@@ -20499,6 +20511,7 @@ function NewClearance({ ctx }) {
20499
20511
  busy,
20500
20512
  demoMode: ctx.me.engineMode === "demo",
20501
20513
  setupRoute: ctx.me.setupRoute,
20514
+ channel: ctx.me.channel ?? null,
20502
20515
  programDisputed: ctx.me.engineProgramDisputed,
20503
20516
  onSettings: seesEverything(ctx.me) ? () => ctx.go("/portal/admin/config") : null,
20504
20517
  searchRefusal: ctx.me.canSearch === false ? ctx.me.searchRefusal ?? null : null,
@@ -20680,7 +20693,7 @@ function NameWall({ count, allowed, first, canScreen, screenName, onScreenAll })
20680
20693
  }) : null]
20681
20694
  });
20682
20695
  }
20683
- function Footer({ startedFrom, tier, detail, uses, duration, runs, ready, busy, demoMode, setupRoute, programDisputed, onSettings, searchRefusal, saveOpen, saveName, saveText, saveNote, saveDone, editing, canSave, blockedBy, onSaveOpen, onSaveName, onSaveText, onSaveCancel, onSave, onReview, onSeeSaved }) {
20696
+ function Footer({ startedFrom, tier, detail, uses, duration, runs, ready, busy, demoMode, setupRoute, channel, programDisputed, onSettings, searchRefusal, saveOpen, saveName, saveText, saveNote, saveDone, editing, canSave, blockedBy, onSaveOpen, onSaveName, onSaveText, onSaveCancel, onSave, onReview, onSeeSaved }) {
20684
20697
  return (0, import_jsx_runtime.jsxs)("div", {
20685
20698
  className: "composer-footer",
20686
20699
  children: [
@@ -20864,7 +20877,10 @@ function Footer({ startedFrom, tier, detail, uses, duration, runs, ready, busy,
20864
20877
  (0, import_jsx_runtime.jsx)("strong", { children: n.headline }),
20865
20878
  " ",
20866
20879
  n.before,
20867
- n.namesSetupCommand ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" ", (0, import_jsx_runtime.jsx)(SetupCommand, { route: setupRoute })] }) : null,
20880
+ n.namesSetupCommand ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" ", (0, import_jsx_runtime.jsx)(SetupCommand, {
20881
+ route: setupRoute,
20882
+ channel
20883
+ })] }) : null,
20868
20884
  n.after ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" ", n.after] }) : null,
20869
20885
  onSettings ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" ", (0, import_jsx_runtime.jsx)("button", {
20870
20886
  type: "button",
@@ -20913,7 +20929,12 @@ function Footer({ startedFrom, tier, detail, uses, duration, runs, ready, busy,
20913
20929
  ]
20914
20930
  });
20915
20931
  }
20916
- function SetupCommand({ route }) {
20932
+ function SetupCommand({ route, channel }) {
20933
+ if (route === "packaged" && channel === "beta") return (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [(0, import_jsx_runtime.jsxs)("code", { children: [
20934
+ "npx ",
20935
+ setupPackage(channel),
20936
+ " install"
20937
+ ] }), "."] });
20917
20938
  if (route === "packaged") return (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [(0, import_jsx_runtime.jsx)("code", { children: "npx clearotron install" }), "."] });
20918
20939
  if (route === "checkout") return (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [(0, import_jsx_runtime.jsx)("code", { children: "npm run setup" }), "."] });
20919
20940
  return (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
@@ -21593,6 +21614,27 @@ var PATH_FIELDS = new Set(["frameworkPath", "workedExamplesPath"]);
21593
21614
  function visibleReadOnlyFields(readOnly, everything) {
21594
21615
  return CODE_OWNED.filter((k) => readOnly[k] !== void 0 && (everything || !PATH_FIELDS.has(k)));
21595
21616
  }
21617
+ var innerValue = (v) => {
21618
+ if (Array.isArray(v)) return v.map(innerValue).join(", ");
21619
+ if (v !== null && typeof v === "object") return Object.entries(v).map(([k, x]) => `${k}: ${innerValue(x)}`).join(", ");
21620
+ return String(v);
21621
+ };
21622
+ function readOnlyValue(v) {
21623
+ if (v == null) return "—";
21624
+ if (Array.isArray(v)) return v.length ? v.map(innerValue).join(", ") : "—";
21625
+ if (typeof v === "object") return Object.entries(v).map(([k, val]) => `${k}: ${innerValue(val)}`).join(" · ");
21626
+ return String(v);
21627
+ }
21628
+ var LANE_NAMES = Object.freeze({
21629
+ ja: "Japanese",
21630
+ ko: "Korean"
21631
+ });
21632
+ function jxPolicyValue(v) {
21633
+ if (v == null || typeof v !== "object" || Array.isArray(v)) return readOnlyValue(v);
21634
+ const { laneDepth, ...rest } = v;
21635
+ const parts = [...laneDepth != null && typeof laneDepth === "object" && !Array.isArray(laneDepth) ? Object.entries(laneDepth).map(([lane, depth]) => `${LANE_NAMES[lane] ?? lane}: ${innerValue(depth)}`) : laneDepth === void 0 ? [] : [`laneDepth: ${innerValue(laneDepth)}`], ...Object.keys(rest).length ? [readOnlyValue(rest)] : []];
21636
+ return parts.length ? parts.join(" · ") : readOnlyValue(v);
21637
+ }
21596
21638
  var FIELD_GROUPS = [
21597
21639
  {
21598
21640
  id: "identity",
@@ -22495,8 +22537,8 @@ function RowMenu({ actions, disabled = false }) {
22495
22537
  function SavedSearches({ ctx }) {
22496
22538
  const account = ctx.owner;
22497
22539
  const needsOwner = ctx.me.allAccounts && account === null;
22498
- const { result, reload } = useLoad(() => api.savedSearches(account), [account]);
22499
- const { result: menu } = useLoad(() => api.searches(account), [account]);
22540
+ const { result, reload } = useLoad(() => companyRead(needsOwner, () => api.savedSearches(account)), [account, needsOwner]);
22541
+ const { result: menu } = useLoad(() => companyRead(needsOwner, () => api.searches(account)), [account, needsOwner]);
22500
22542
  const levels = menu?.kind === "ok" ? menu.value.products : [];
22501
22543
  const [busy, setBusy] = (0, import_react.useState)(null);
22502
22544
  const [confirming, setConfirming] = (0, import_react.useState)(null);
@@ -23542,11 +23584,11 @@ function ContextPackEditor({ value, onChange, title, hint, rows = 8, tag = null,
23542
23584
  function Profile({ ctx }) {
23543
23585
  const account = ctx.owner;
23544
23586
  const needsOwner = ctx.me.allAccounts && account === null;
23545
- const { result, reload } = useLoad(() => api.profile(account), [account]);
23587
+ const { result, reload } = useLoad(() => companyRead(needsOwner, () => api.profile(account)), [account, needsOwner]);
23546
23588
  const loaded = result?.kind === "ok" ? result.value : null;
23547
- const { result: searchesResult } = useLoad(() => api.searches(account), [account]);
23589
+ const { result: searchesResult } = useLoad(() => companyRead(needsOwner, () => api.searches(account)), [account, needsOwner]);
23548
23590
  const productChoices = searchesResult == null ? null : searchesResult.kind === "ok" ? depthChoices(searchesResult.value.products) : [];
23549
- const { result: templatesResult } = useLoad(() => api.savedSearches(account), [account]);
23591
+ const { result: templatesResult } = useLoad(() => companyRead(needsOwner, () => api.savedSearches(account)), [account, needsOwner]);
23550
23592
  const permitted = loaded == null || templatesResult == null || searchesResult == null ? "" : permittedSearchesLine(loaded.readOnly["allowedRecipes"], loaded.account, templatesResult.kind === "ok" ? templatesResult.value : null, searchesResult.kind === "ok" ? searchesResult.value.products : []);
23551
23593
  const [draft, setDraft] = (0, import_react.useState)(null);
23552
23594
  const [pack, setPack] = (0, import_react.useState)(null);
@@ -23992,7 +24034,7 @@ function FrameworkBlock({ readOnly, framework, everything, permitted }) {
23992
24034
  value: "Used when rating this company"
23993
24035
  }) : null, entries.map((k) => (0, import_jsx_runtime.jsx)(Row$2, {
23994
24036
  label: LABELS[k] ?? k,
23995
- value: k === "allowedRecipes" ? permitted : render(readOnly[k])
24037
+ value: k === "allowedRecipes" ? permitted : k === "jxPolicy" ? jxPolicyValue(readOnly[k]) : readOnlyValue(readOnly[k])
23996
24038
  }, k))]
23997
24039
  }) : null,
23998
24040
  (0, import_jsx_runtime.jsx)("div", {
@@ -24009,12 +24051,6 @@ var LABELS = {
24009
24051
  jxPolicy: "Jurisdiction policy",
24010
24052
  runCaps: "Run limits"
24011
24053
  };
24012
- var render = (v) => {
24013
- if (v == null) return "—";
24014
- if (Array.isArray(v)) return v.length ? v.map(String).join(", ") : "—";
24015
- if (typeof v === "object") return Object.entries(v).map(([k, val]) => `${k}: ${String(val)}`).join(" · ");
24016
- return String(v);
24017
- };
24018
24054
  function Row$2({ label, value }) {
24019
24055
  return (0, import_jsx_runtime.jsxs)("div", {
24020
24056
  className: "fw-row",
@@ -24086,7 +24122,7 @@ function Projects({ ctx }) {
24086
24122
  const [rowBusy, setRowBusy] = (0, import_react.useState)(null);
24087
24123
  const [confirming, setConfirming] = (0, import_react.useState)(null);
24088
24124
  const [rowProblem, setRowProblem] = (0, import_react.useState)(null);
24089
- const { result, reload } = useLoad(() => api.projects(account), [account]);
24125
+ const { result, reload } = useLoad(() => companyRead(needsOwner, () => api.projects(account)), [account, needsOwner]);
24090
24126
  const projects = result?.kind === "ok" ? result.value : [];
24091
24127
  if (needsOwner || result?.kind === "pickAccount") return (0, import_jsx_runtime.jsx)(CompanyGate, {
24092
24128
  ctx,
@@ -25163,7 +25199,8 @@ function GlobalConfig({ ctx }) {
25163
25199
  className: "cfg-rows",
25164
25200
  children: [v.engine ? (0, import_jsx_runtime.jsx)(Engine, {
25165
25201
  engine: v.engine,
25166
- programDisputed: (v.lastRun?.disagrees ?? []).some((d) => d.what === "engine program")
25202
+ programDisputed: (v.lastRun?.disagrees ?? []).some((d) => d.what === "engine program"),
25203
+ channel: ctx.me.channel ?? null
25167
25204
  }) : (0, import_jsx_runtime.jsx)(NotRecorded, {
25168
25205
  what: "which engine is running",
25169
25206
  source: v.source
@@ -25304,8 +25341,11 @@ var NotServed = () => (0, import_jsx_runtime.jsx)("div", {
25304
25341
  },
25305
25342
  children: "This version of the portal does not report how people sign in. It will say after this service is upgraded — a search engine drain will not add it."
25306
25343
  });
25307
- function Engine({ engine, programDisputed = false }) {
25308
- return (0, import_jsx_runtime.jsx)(Row$1, { ...engineRow(engine, { programDisputed }) });
25344
+ function Engine({ engine, programDisputed = false, channel = null }) {
25345
+ return (0, import_jsx_runtime.jsx)(Row$1, { ...engineRow(engine, {
25346
+ programDisputed,
25347
+ channel
25348
+ }) });
25309
25349
  }
25310
25350
  function Row$1({ ok, off = false, name, mono, state, faults, note = null, detail = null, guide = null, repo = null }) {
25311
25351
  const tone = ok ? "" : off ? " off" : " bad";
@@ -36,7 +36,7 @@
36
36
  chosen anywhere in the product holds everywhere in it.
37
37
  -->
38
38
  <script>(function(){try{var t=localStorage.getItem('cordillera-theme');if(t==='dark'||t==='light')document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
39
- <script type="module" crossorigin src="/portal/assets/index-C1oE78Wk.js"></script>
39
+ <script type="module" crossorigin src="/portal/assets/index-fPqAU0sx.js"></script>
40
40
  <link rel="stylesheet" crossorigin href="/portal/assets/index-AtB9ZpDH.css">
41
41
  </head>
42
42
  <body>
@@ -2,7 +2,7 @@
2
2
  "name": "portal-ui",
3
3
  "private": true,
4
4
  "type": "module",
5
- "version": "0.5.1-beta.0",
5
+ "version": "0.5.1-beta.2",
6
6
  "license": "AGPL-3.0-only",
7
7
  "description": "The unified trademark portal UI. One address, one login: who you are decides what you see. Built as a static bundle, served by driver/portal-service.mjs — the browser never reaches profile-service or recipe-service.",
8
8
  "engines": {
@@ -1,5 +1,13 @@
1
1
  # trademark-oauth-mcp-bridge
2
2
 
3
+ ## 0.5.1-beta.2
4
+
5
+ No changes in this release.
6
+
7
+ ## 0.5.1-beta.1
8
+
9
+ No changes in this release.
10
+
3
11
  ## 0.5.1-beta.0
4
12
 
5
13
  No changes in this release.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trademark-oauth-mcp-bridge",
3
- "version": "0.5.1-beta.0",
3
+ "version": "0.5.1-beta.2",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": true,
6
6
  "description": "OAuth 2.1 MCP stdio bridge used by the engine's case-law gather stage (courtlistener / legaldatahunter).",
@@ -55,6 +55,16 @@ export function channelOf(version) {
55
55
  return pre ? pre.toLowerCase() : "latest";
56
56
  }
57
57
 
58
+ /**
59
+ * The package a printed command names, on the channel this version came from: `clearotron@beta` on a beta,
60
+ * and the bare `clearotron` on the stable, so a stable's commands read exactly as they always have. The bare
61
+ * name fetches `latest`, so on a beta `npx clearotron …` runs the stable's code against the beta's install.
62
+ */
63
+ export function channelPackage(version = ownVersion()) {
64
+ const channel = channelOf(version);
65
+ return channel === "latest" ? "clearotron" : `clearotron@${channel}`;
66
+ }
67
+
58
68
  /**
59
69
  * What `install` does first when it runs from npx. PURE given its inputs.
60
70
  *
@@ -45,7 +45,7 @@
45
45
  //
46
46
  // ── ONE AUTHORITY, TWO CALLERS ───────────────────────────────────────────────────────────────────────
47
47
  //
48
- // NOT TO BE CONFUSED WITH `SERVER_UNITS` IN bin/start.mjs, which is one word away and answers a
48
+ // NOT TO BE CONFUSED WITH `SERVER_UNITS` below, which is one word away and answers a
49
49
  // different question: which units, IF PRESENT, mean this box is already a server. That one is a
50
50
  // DETECTOR — it exists so `clearotron start` can refuse to run a second portal beside a deployed one —
51
51
  // and it deliberately still names a retired unit, because a box carrying the old posture is just as
@@ -95,6 +95,42 @@ export const SERVER_INSTALL_SET = Object.freeze([
95
95
  // Deleting the export would make the next such unit an unnamed absence instead.
96
96
  export const ON_DEMAND_UNITS = Object.freeze([]);
97
97
 
98
+ /**
99
+ * The DETECTOR: the shipped units that, if present, make this box a server. A door unit alone is enough; so
100
+ * is the drain. It answers a different question from SERVER_INSTALL_SET above (see ONE AUTHORITY, TWO
101
+ * CALLERS), and that is why it is a separate list. It lived in `bin/start.mjs`, which still exports it; it is
102
+ * here so the portal can ask the same question without importing a command.
103
+ */
104
+ export const SERVER_UNITS = Object.freeze([
105
+ "clearotron-portal.service", "clearotron-mcp-face.service", "prelim-driver.service",
106
+ ]);
107
+
108
+ // ── UNITS `start --background` ONCE INSTALLED AND NOW RETIRES ─────────────────────────────
109
+ //
110
+ // A box that ran `--background` before the retirement HAS these installed and enabled. They must stay
111
+ // MANAGED, or a background start reads them as foreign, concludes the box is a real server, and refuses on
112
+ // exactly the boxes it previously worked on — "making the flag unrunnable exactly once it has worked".
113
+ //
114
+ // AND THEY MUST BE DISARMED, not merely unpinned: `bin/start.mjs` disables each one it finds.
115
+ //
116
+ // EMPTY, AND KEPT RATHER THAN DELETED. The retired path-watcher/timer units it named are gone from the
117
+ // tree, so naming them here would describe files this repo does not ship — which is exactly what the
118
+ // "every retired unit is a unit this repo actually ships" check refuses. The export stays because the
119
+ // next retirement wants somewhere to go, and an empty list is a statement that nothing is currently
120
+ // retired-but-shipped. It lived in `bin/start.mjs`, which still exports it.
121
+ export const BACKGROUND_RETIRED = Object.freeze([]);
122
+
123
+ /**
124
+ * Whether `clearotron start --background` would REFRESH the units installed here rather than refuse: some
125
+ * server unit is installed, and every one of them is a unit it manages. `installed` is the DETECTOR's answer
126
+ * (SERVER_UNITS present). One rule for `bin/start.mjs`, which acts on it, and for the portal's refusal, which
127
+ * tells an operator to run that command only where it would work. PURE.
128
+ */
129
+ export function aBackgroundStartRefreshes(installed) {
130
+ const managed = new Set([...SERVER_INSTALL_SET, ...BACKGROUND_RETIRED]);
131
+ return installed.length > 0 && installed.every((u) => managed.has(u));
132
+ }
133
+
98
134
  /**
99
135
  * Which of the installed units a `--background` REFRESH must restart.
100
136
  *