@parhelia/alpaca 0.4.13049 → 0.4.13170

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.
@@ -18,29 +18,23 @@ export function TracingTitlebar() {
18
18
  const countdown = recording?.autoOffAtUtc ? formatCountdown((Date.parse(recording.autoOffAtUtc) - now) / 1000) : "recording";
19
19
  if (!editContext?.workspace || editContext.isMobile)
20
20
  return null;
21
- // Until the instance's status arrives the view knows neither its state nor its process generation, which every
22
- // mutation must echo: the indicators read "loading…" and their menus stay closed instead of offering "off" actions
23
- // that the instance would refuse as coming from a stale view.
24
- const loading = !status;
25
21
  const attachment = status?.browserAttachment;
26
22
  const attached = !!attachment?.sessionId && !attachment.stale;
27
23
  const source = selectedSource(state);
28
24
  const canPersist = !!status?.storageAvailable && !!source && source.kind !== "global" && (source.kind !== "capture" || (!!source.finalized && !status.storageOutdated));
29
25
  const confirm = editContext.confirm;
30
- return (_jsxs("div", { className: "flex w-full min-w-0 items-center justify-between gap-3 overflow-hidden pr-2 pl-2", "data-testid": "alpaca-tracing-titlebar", children: [_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2 overflow-hidden", children: [remote ? _jsxs("span", { className: "text-xs text-neutral-grey-50", children: ["Remote: ", state.selectedInstance, " (no cookie recording)"] }) : _jsx(_Fragment, { children: _jsx(Menu, { testId: "alpaca-tracing-browser-menu", trigger: _jsx(Indicator, { icon: _jsx(User, { className: "h-3.5 w-3.5", strokeWidth: 1.5 }), on: attached, label: "This browser", value: loading
31
- ? "loading…"
32
- : attached
33
- ? `recording to “${attachment?.name ?? "session"}”`
34
- : attachment?.stale
35
- ? "stale attachment"
36
- : "not recording", disabled: loading }), children: attached ? (_jsxs(_Fragment, { children: [_jsx(MenuItem, { onClick: () => void traceActions.detach(), testId: "alpaca-tracing-detach", children: "Detach (stop recording, keep the session)" }), _jsx(MenuItem, { destructive: true, onClick: () => confirm({
26
+ return (_jsxs("div", { className: "flex w-full min-w-0 items-center justify-between gap-3 overflow-hidden pr-2 pl-2", "data-testid": "alpaca-tracing-titlebar", children: [_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2 overflow-hidden", children: [remote ? _jsxs("span", { className: "text-xs text-neutral-grey-50", children: ["Remote: ", state.selectedInstance, " (no cookie recording)"] }) : _jsx(_Fragment, { children: _jsx(Menu, { testId: "alpaca-tracing-browser-menu", trigger: _jsx(Indicator, { icon: _jsx(User, { className: "h-3.5 w-3.5", strokeWidth: 1.5 }), on: attached, label: "This browser", value: attached
27
+ ? `recording to “${attachment?.name ?? "session"}”`
28
+ : attachment?.stale
29
+ ? "stale attachment"
30
+ : "not recording" }), children: attached ? (_jsxs(_Fragment, { children: [_jsx(MenuItem, { onClick: () => void traceActions.detach(), testId: "alpaca-tracing-detach", children: "Detach (stop recording, keep the session)" }), _jsx(MenuItem, { destructive: true, onClick: () => confirm({
37
31
  header: "Detach and delete session",
38
32
  message: `Delete the session “${attachment?.name ?? ""}” and everything it recorded on this instance?`,
39
33
  acceptLabel: "Delete",
40
34
  accept: () => {
41
35
  void traceActions.deleteSession(attachment.sessionId, false);
42
36
  },
43
- }), testId: "alpaca-tracing-detach-delete", children: "Detach and delete session\u2026" })] })) : (_jsxs(MenuItem, { onClick: () => void traceActions.recordMySession(), testId: "alpaca-tracing-record-my-session", children: ["Record my session", _jsx("span", { className: "block text-2xs text-neutral-grey-50", children: "Traces every request this browser makes to this instance." })] })) }) }), _jsx(Menu, { testId: "alpaca-tracing-global-menu", trigger: _jsx(Indicator, { icon: _jsx(Globe, { className: "h-3.5 w-3.5", strokeWidth: 1.5 }), on: !!status?.globalEnabled, onTone: "warning", label: "Global", value: loading ? "loading…" : status.globalEnabled ? countdown : "off", disabled: loading }), children: status?.globalEnabled ? (_jsxs(_Fragment, { children: [support.keep === "capture" ? _jsxs(_Fragment, { children: [_jsx(MenuItem, { onClick: () => void traceActions.stopGlobal(), testId: "alpaca-tracing-stop-global", children: "Stop and keep capture" }), _jsx(MenuItem, { destructive: true, onClick: () => confirm({ header: "Discard recording", message: "Discard this instance's active recording and its evidence?", acceptLabel: "Discard", accept: () => { void traceActions.disableGlobal(); } }), children: "Discard\u2026" })] }) : _jsx(MenuItem, { onClick: () => confirm({ header: "Stop recording", message: "Stop this instance's recording? The recorded stories are discarded. Keeping stopped recordings is not available on this instance.", acceptLabel: "Stop", accept: () => { void traceActions.disableGlobal(); } }), testId: "alpaca-tracing-stop-global", children: "Stop recording\u2026" }), support.autoOff && [5, 10, 30, 60].filter(minutes => minutes <= (recording?.maxAutoOffMinutes ?? 60)).map(minutes => _jsxs(MenuItem, { onClick: () => void traceActions.setAutoOff(minutes), children: ["Stop in ", minutes, " min"] }, minutes))] })) : (_jsxs(_Fragment, { children: [support.autoOff && [5, 10, 30, 60].filter(minutes => minutes <= (recording?.maxAutoOffMinutes ?? 60)).map(minutes => _jsxs(MenuItem, { onClick: () => void traceActions.enableGlobal(minutes), children: ["Record everything for ", minutes, " min\u2026"] }, minutes)), (!remote || !support.autoOff) && _jsx(MenuItem, { onClick: () => void traceActions.enableGlobal(null), children: "Record everything until stopped\u2026" })] })) }), status && _jsx(InstanceLine, { status: status })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [_jsx(SimpleIconButton, { icon: _jsx(Crosshair, { className: "h-5 w-5", strokeWidth: 1 }), label: state.follow ? "Stop following the newest story" : "Follow the newest story", size: "large", selected: state.follow, onClick: () => traceActions.setFollow(!state.follow), "data-testid": "alpaca-tracing-follow" }), _jsx(SimpleIconButton, { icon: _jsx(Save, { className: "h-5 w-5", strokeWidth: 1 }), label: !status?.storageAvailable
37
+ }), testId: "alpaca-tracing-detach-delete", children: "Detach and delete session\u2026" })] })) : (_jsxs(MenuItem, { onClick: () => void traceActions.recordMySession(), testId: "alpaca-tracing-record-my-session", children: ["Record my session", _jsx("span", { className: "block text-2xs text-neutral-grey-50", children: "Traces every request this browser makes to this instance." })] })) }) }), _jsx(Menu, { testId: "alpaca-tracing-global-menu", trigger: _jsx(Indicator, { icon: _jsx(Globe, { className: "h-3.5 w-3.5", strokeWidth: 1.5 }), on: !!status?.globalEnabled, onTone: "warning", label: "Global", value: status?.globalEnabled ? countdown : "off" }), children: status?.globalEnabled ? (_jsxs(_Fragment, { children: [support.keep === "capture" ? _jsxs(_Fragment, { children: [_jsx(MenuItem, { onClick: () => void traceActions.stopGlobal(), testId: "alpaca-tracing-stop-global", children: "Stop and keep capture" }), _jsx(MenuItem, { destructive: true, onClick: () => confirm({ header: "Discard recording", message: "Discard this instance's active recording and its evidence?", acceptLabel: "Discard", accept: () => { void traceActions.disableGlobal(); } }), children: "Discard\u2026" })] }) : _jsx(MenuItem, { onClick: () => confirm({ header: "Stop recording", message: "Stop this instance's recording? The recorded stories are discarded. Keeping stopped recordings is not available on this instance.", acceptLabel: "Stop", accept: () => { void traceActions.disableGlobal(); } }), testId: "alpaca-tracing-stop-global", children: "Stop recording\u2026" }), support.autoOff && [5, 10, 30, 60].filter(minutes => minutes <= (recording?.maxAutoOffMinutes ?? 60)).map(minutes => _jsxs(MenuItem, { onClick: () => void traceActions.setAutoOff(minutes), children: ["Stop in ", minutes, " min"] }, minutes))] })) : (_jsxs(_Fragment, { children: [support.autoOff && [5, 10, 30, 60].filter(minutes => minutes <= (recording?.maxAutoOffMinutes ?? 60)).map(minutes => _jsxs(MenuItem, { onClick: () => void traceActions.enableGlobal(minutes), children: ["Record everything for ", minutes, " min\u2026"] }, minutes)), (!remote || !support.autoOff) && _jsx(MenuItem, { onClick: () => void traceActions.enableGlobal(null), children: "Record everything until stopped\u2026" })] })) }), status && _jsx(InstanceLine, { status: status })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [_jsx(SimpleIconButton, { icon: _jsx(Crosshair, { className: "h-5 w-5", strokeWidth: 1 }), label: state.follow ? "Stop following the newest story" : "Follow the newest story", size: "large", selected: state.follow, onClick: () => traceActions.setFollow(!state.follow), "data-testid": "alpaca-tracing-follow" }), _jsx(SimpleIconButton, { icon: _jsx(Save, { className: "h-5 w-5", strokeWidth: 1 }), label: !status?.storageAvailable
44
38
  ? "Trace storage is not installed on this instance"
45
39
  : source?.kind === "global" && !support.persistGlobal ? "Persisting the global recording is not available on this instance"
46
40
  : source?.kind === "capture" && status.storageOutdated ? "Update Alpaca.Tracing.Storage to persist captures"
@@ -93,7 +87,7 @@ function InstanceLine({ status }) {
93
87
  }
94
88
  // Used as a Radix PopoverTrigger child (asChild): it must forward the ref and spread the trigger props.
95
89
  const Indicator = forwardRef(function Indicator({ icon, on, onTone = "success", label, value, className, ...props }, ref) {
96
- return (_jsxs("button", { ref: ref, type: "button", title: `${label}: ${value}`, ...props, className: cls("flex h-8 min-w-0 shrink items-center gap-1.5 rounded border border-border-default bg-background px-2 text-xs whitespace-nowrap text-neutral-grey-100 hover:bg-neutral-grey-5 disabled:cursor-wait disabled:opacity-60 disabled:hover:bg-background", className), children: [_jsx("span", { className: cls("inline-block h-2 w-2 rounded-full", on ? (onTone === "warning" ? "animate-pulse bg-feedback-red" : "animate-pulse bg-feedback-green") : "bg-neutral-grey-15") }), icon, _jsxs("span", { className: "shrink-0 text-neutral-grey-50", children: [label, ":"] }), _jsx("span", { className: "min-w-0 max-w-[220px] truncate", children: value }), _jsx(ChevronDown, { className: "h-3 w-3 text-neutral-grey-50", strokeWidth: 1.5 })] }));
90
+ return (_jsxs("button", { ref: ref, type: "button", title: `${label}: ${value}`, ...props, className: cls("flex h-8 min-w-0 shrink items-center gap-1.5 rounded border border-border-default bg-background px-2 text-xs whitespace-nowrap text-neutral-grey-100 hover:bg-neutral-grey-5", className), children: [_jsx("span", { className: cls("inline-block h-2 w-2 rounded-full", on ? (onTone === "warning" ? "animate-pulse bg-feedback-red" : "animate-pulse bg-feedback-green") : "bg-neutral-grey-15") }), icon, _jsxs("span", { className: "shrink-0 text-neutral-grey-50", children: [label, ":"] }), _jsx("span", { className: "min-w-0 max-w-[220px] truncate", children: value }), _jsx(ChevronDown, { className: "h-3 w-3 text-neutral-grey-50", strokeWidth: 1.5 })] }));
97
91
  });
98
92
  export function Menu({ trigger, children, align = "start", testId, }) {
99
93
  const [open, setOpen] = useState(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parhelia/alpaca",
3
- "version": "0.4.13049",
3
+ "version": "0.4.13170",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -42,8 +42,12 @@
42
42
  "typescript": "npm:@typescript/typescript6@6.0.2"
43
43
  },
44
44
  "dependencies": {
45
+ "@graphiql/plugin-explorer": "^5.1.5",
46
+ "@graphiql/react": "^0.39.0",
45
47
  "@parhelia/core": "*",
46
48
  "@uiw/react-textarea-code-editor": "^3.1.1",
49
+ "graphiql": "^5.4.0",
50
+ "graphql": "^17.0.2",
47
51
  "lucide-react": "^1.38.0",
48
52
  "postcss": "^8.5.26",
49
53
  "react": "19.2.8",