reifyui 0.13.12 → 0.13.14

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/dist/graph.d.ts CHANGED
@@ -7,7 +7,8 @@ export interface GraphClient {
7
7
  putConnect(graphId: string, registry: unknown): Promise<unknown>;
8
8
  testConnectTool(graphId: string, tool: string, args: Record<string, unknown>): Promise<unknown>;
9
9
  listConnectKeys(graphId: string): Promise<unknown[]>;
10
- createConnectKey(graphId: string, name: string): Promise<unknown>;
10
+ /** `readOnly`: the key may only read; the answer's `read_only` says what was minted. */
11
+ createConnectKey(graphId: string, name: string, opts?: { readOnly?: boolean }): Promise<unknown>;
11
12
  revokeConnectKey(graphId: string, keyId: string): Promise<unknown>;
12
13
  fetchAudit(graphId: string, params: { limit?: number; cursor?: string | null; q?: string }): Promise<unknown>;
13
14
  /** Absolute URL for a gateway path (the MCP endpoint shown to the user). */
package/dist/graph.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  import "./chunk-J633KV57.js";
6
6
  import {
7
7
  useLiveDoc
8
- } from "./chunk-Q342JSCO.js";
8
+ } from "./chunk-24ZEZWSA.js";
9
9
  import {
10
10
  peerColor
11
11
  } from "./chunk-ZYWE47EO.js";
@@ -1133,6 +1133,7 @@ function KeyRow({ k, onRevoke }) {
1133
1133
  /* @__PURE__ */ jsx3(KeyRound, { size: 13, "aria-hidden": "true" }),
1134
1134
  k.name || "\u2014"
1135
1135
  ] }),
1136
+ k.read_only && /* @__PURE__ */ jsx3("span", { className: "pill brand cn-key-ro", title: "Agents with this key can read but not change anything", children: "Read only" }),
1136
1137
  /* @__PURE__ */ jsx3("code", { className: "mono cn-key-prefix", children: k.prefix ? `${k.prefix}\u2026` : "\u2014" }),
1137
1138
  /* @__PURE__ */ jsxs2("span", { className: "cn-key-meta", children: [
1138
1139
  /* @__PURE__ */ jsx3("span", { className: "cn-key-lbl", children: "Created" }),
@@ -1192,6 +1193,7 @@ function ConnectionCard({ url, keys, expanded, onToggle, onCreateKey, onRevoke }
1192
1193
  }
1193
1194
  function CreateKeyDialog({ busy, error, onSubmit, onClose }) {
1194
1195
  const [name, setName] = useState3("");
1196
+ const [readOnly, setReadOnly] = useState3(false);
1195
1197
  const ref = useRef3(null);
1196
1198
  useEffect3(() => {
1197
1199
  ref.current?.focus();
@@ -1201,7 +1203,7 @@ function CreateKeyDialog({ busy, error, onSubmit, onClose }) {
1201
1203
  /* @__PURE__ */ jsx3("div", { className: "cn-dlg-body", children: "Name the key after the agent or place that will use it, so you can tell keys apart later." }),
1202
1204
  /* @__PURE__ */ jsxs2("form", { onSubmit: (e) => {
1203
1205
  e.preventDefault();
1204
- if (ok && !busy) onSubmit(name.trim());
1206
+ if (ok && !busy) onSubmit(name.trim(), readOnly);
1205
1207
  }, children: [
1206
1208
  /* @__PURE__ */ jsx3(
1207
1209
  "input",
@@ -1214,6 +1216,13 @@ function CreateKeyDialog({ busy, error, onSubmit, onClose }) {
1214
1216
  maxLength: 80
1215
1217
  }
1216
1218
  ),
1219
+ /* @__PURE__ */ jsxs2("label", { className: "cn-ro-opt", children: [
1220
+ /* @__PURE__ */ jsx3("input", { type: "checkbox", checked: readOnly, disabled: busy, onChange: (e) => setReadOnly(e.target.checked) }),
1221
+ /* @__PURE__ */ jsxs2("span", { children: [
1222
+ /* @__PURE__ */ jsx3("span", { className: "cn-ro-title", children: "Read only" }),
1223
+ /* @__PURE__ */ jsx3("span", { className: "cn-ro-hint", children: "Agents with this key can read your data but can't change or delete anything. This can't be changed later." })
1224
+ ] })
1225
+ ] }),
1217
1226
  error && /* @__PURE__ */ jsx3("div", { className: "cn-err", children: error }),
1218
1227
  /* @__PURE__ */ jsxs2("div", { className: "cn-dlg-foot", children: [
1219
1228
  /* @__PURE__ */ jsx3("button", { type: "button", className: "btn", onClick: onClose, disabled: busy, children: "Cancel" }),
@@ -1224,7 +1233,10 @@ function CreateKeyDialog({ busy, error, onSubmit, onClose }) {
1224
1233
  }
1225
1234
  function SecretDialog({ secret, onClose }) {
1226
1235
  return /* @__PURE__ */ jsxs2(Modal, { open: true, onClose, title: "Your new API key", width: 480, classNames: { root: "cn-dlg" }, children: [
1227
- /* @__PURE__ */ jsx3("div", { className: "cn-dlg-body", children: "Copy this key now and store it somewhere safe. For your security, it will not be shown again." }),
1236
+ /* @__PURE__ */ jsxs2("div", { className: "cn-dlg-body", children: [
1237
+ "Copy this key now and store it somewhere safe. For your security, it will not be shown again.",
1238
+ secret.read_only && " This key can only read."
1239
+ ] }),
1228
1240
  /* @__PURE__ */ jsx3("div", { className: "cn-secret", children: /* @__PURE__ */ jsx3("code", { className: "mono", children: secret.key }) }),
1229
1241
  /* @__PURE__ */ jsxs2("div", { className: "cn-dlg-foot", children: [
1230
1242
  /* @__PURE__ */ jsx3(CopyButton, { text: secret.key, label: "Copy key", sm: false }),
@@ -1486,11 +1498,25 @@ function ConnectPane({ graphId, liveRegistry, client }) {
1486
1498
  setConfirmBusy(false);
1487
1499
  }
1488
1500
  };
1489
- const doCreateKey = async (name) => {
1501
+ const doCreateKey = async (name, readOnly) => {
1490
1502
  setCreateBusy(true);
1491
1503
  setCreateError("");
1492
1504
  try {
1493
- const minted = await client.createConnectKey(graphId, name);
1505
+ const minted = await client.createConnectKey(graphId, name, { readOnly });
1506
+ if (readOnly && minted?.read_only !== true) {
1507
+ let gone = true;
1508
+ try {
1509
+ await client.revokeConnectKey(graphId, minted.id);
1510
+ } catch {
1511
+ gone = false;
1512
+ }
1513
+ const list = await client.listConnectKeys(graphId);
1514
+ setKeys(list);
1515
+ if (gone) throw new Error("Read-only keys aren\u2019t available yet. No key was created.");
1516
+ const row = list.find((k) => k.id === minted.id);
1517
+ const mark = row?.prefix ? `${row.prefix}\u2026` : minted.id;
1518
+ throw new Error(`Read-only keys aren\u2019t available yet. Revoke the key \u201C${name}\u201D (${mark}) from the list.`);
1519
+ }
1494
1520
  setCreatingKey(false);
1495
1521
  setSecret(minted);
1496
1522
  setKeys(await client.listConnectKeys(graphId));