@tooluminati/react-troubleshooting 0.1.0 → 0.2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"WebMcpTroubleshootingPanel.d.ts","sourceRoot":"","sources":["../src/WebMcpTroubleshootingPanel.tsx"],"names":[],"mappings":"AAiBA,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAYD,wBAAgB,0BAA0B,CAAC,EACzC,QAAe,EACf,cAAc,EACd,iBAAiB,GAClB,EAAE,+BAA+B,sCAkTjC"}
1
+ {"version":3,"file":"WebMcpTroubleshootingPanel.d.ts","sourceRoot":"","sources":["../src/WebMcpTroubleshootingPanel.tsx"],"names":[],"mappings":"AAkBA,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAYD,wBAAgB,0BAA0B,CAAC,EACzC,QAAe,EACf,cAAc,EACd,iBAAiB,GAClB,EAAE,+BAA+B,sCAsTjC"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useState } from 'react';
3
- import { filterPanelEvents, serializeTroubleshootingDiagnostics, } from '@tooluminati/diagnostics';
3
+ import { filterPanelEvents, serializeTroubleshootingDiagnostics, ensureDeclarativeFocusStyles, } from '@tooluminati/diagnostics';
4
4
  import { useWebMcpTroubleshootingContext } from './WebMcpTroubleshootingContext';
5
5
  const PALETTE = {
6
6
  surface: '#0a0e1a',
@@ -24,6 +24,9 @@ export function WebMcpTroubleshootingPanel({ position = 'br', startCollapsed, on
24
24
  const [openErrors, setOpenErrors] = useState({});
25
25
  const [copied, setCopied] = useState(false);
26
26
  const [spinning, setSpinning] = useState(false);
27
+ useEffect(() => {
28
+ ensureDeclarativeFocusStyles();
29
+ }, []);
27
30
  useEffect(() => {
28
31
  if (startCollapsed) {
29
32
  visibility.setCollapsed(true);
@@ -1,4 +1,5 @@
1
1
  import { type FormEventHandler, type InputHTMLAttributes, type ReactNode, type SelectHTMLAttributes, type TextareaHTMLAttributes, type FormHTMLAttributes } from 'react';
2
+ export { isAgentInvokedSubmit, respondWithAgentResult, WEBMCP_DECLARATIVE_FOCUS_STYLES, ensureDeclarativeFocusStyles, } from '@tooluminati/diagnostics';
2
3
  export interface WebMcpFormProps extends FormHTMLAttributes<HTMLFormElement> {
3
4
  toolName: string;
4
5
  toolDescription: string;
@@ -16,6 +17,7 @@ export declare function WebMcpTextarea(props: TextareaHTMLAttributes<HTMLTextAre
16
17
  toolParamDescription?: string;
17
18
  }): import("react").JSX.Element;
18
19
  export declare function useAgentInvokedSubmit(handler: FormEventHandler<HTMLFormElement>): FormEventHandler<HTMLFormElement>;
20
+ export declare function useAgentSubmitRespondWith(getResult: () => unknown | Promise<unknown>): FormEventHandler<HTMLFormElement>;
19
21
  export interface DeclarativeFormToolEventsOptions {
20
22
  formSelector?: string;
21
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"declarative-form.d.ts","sourceRoot":"","sources":["../src/declarative-form.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB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/jsx-runtime";
2
+ import { isAgentInvokedSubmit, respondWithAgentResult, } from '@tooluminati/diagnostics';
3
+ export { isAgentInvokedSubmit, respondWithAgentResult, WEBMCP_DECLARATIVE_FOCUS_STYLES, ensureDeclarativeFocusStyles, } from '@tooluminati/diagnostics';
2
4
  export function WebMcpForm({ toolName, toolDescription, toolAutoSubmit, children, ...props }) {
3
5
  return (_jsx("form", { ...props, toolname: toolName, tooldescription: toolDescription, ...(toolAutoSubmit ? { toolautosubmit: '' } : {}), children: children }));
4
6
  }
@@ -22,12 +24,22 @@ export function WebMcpTextarea(props) {
22
24
  }
23
25
  export function useAgentInvokedSubmit(handler) {
24
26
  return (event) => {
25
- const submitEvent = event.nativeEvent;
26
- if (submitEvent.agentInvoked) {
27
+ if (isAgentInvokedSubmit(event.nativeEvent)) {
27
28
  handler(event);
28
29
  }
29
30
  };
30
31
  }
32
+ export function useAgentSubmitRespondWith(getResult) {
33
+ return (event) => {
34
+ const nativeEvent = event.nativeEvent;
35
+ if (!isAgentInvokedSubmit(nativeEvent) ||
36
+ typeof nativeEvent.respondWith !== 'function') {
37
+ return;
38
+ }
39
+ // Supply respondWith synchronously; capture synchronous handler failures in its promise.
40
+ respondWithAgentResult(nativeEvent, Promise.resolve().then(getResult));
41
+ };
42
+ }
31
43
  export function useDeclarativeFormToolEvents(_options = {}) {
32
44
  // Agent form submits are captured by createWebMcpLifecycleCollector().
33
45
  }
package/dist/index.cjs CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ WEBMCP_DECLARATIVE_FOCUS_STYLES: () => import_diagnostics6.WEBMCP_DECLARATIVE_FOCUS_STYLES,
23
24
  WebMcpErrorBoundary: () => WebMcpErrorBoundary,
24
25
  WebMcpForm: () => WebMcpForm,
25
26
  WebMcpInput: () => WebMcpInput,
@@ -29,12 +30,16 @@ __export(index_exports, {
29
30
  WebMcpTroubleshootingPanel: () => WebMcpTroubleshootingPanel,
30
31
  WebMcpTroubleshootingProvider: () => WebMcpTroubleshootingProvider,
31
32
  createFormSubmitBlockersProvider: () => createFormSubmitBlockersProvider,
33
+ ensureDeclarativeFocusStyles: () => import_diagnostics6.ensureDeclarativeFocusStyles,
32
34
  getPanelVisibilityController: () => getPanelVisibilityController,
33
35
  hideWebMcpTroubleshootingPanel: () => hideWebMcpTroubleshootingPanel,
36
+ isAgentInvokedSubmit: () => import_diagnostics6.isAgentInvokedSubmit,
34
37
  resetPanelVisibilityController: () => resetPanelVisibilityController,
38
+ respondWithAgentResult: () => import_diagnostics6.respondWithAgentResult,
35
39
  showWebMcpTroubleshootingPanel: () => showWebMcpTroubleshootingPanel,
36
40
  toggleWebMcpTroubleshootingPanel: () => toggleWebMcpTroubleshootingPanel,
37
41
  useAgentInvokedSubmit: () => useAgentInvokedSubmit,
42
+ useAgentSubmitRespondWith: () => useAgentSubmitRespondWith,
38
43
  useDeclarativeFormToolEvents: () => useDeclarativeFormToolEvents,
39
44
  useFormSubmitBlockers: () => useFormSubmitBlockers,
40
45
  useTanStackQueryWebMcpTools: () => useTanStackQueryWebMcpTools,
@@ -98,6 +103,9 @@ function WebMcpTroubleshootingPanel({
98
103
  const [openErrors, setOpenErrors] = (0, import_react3.useState)({});
99
104
  const [copied, setCopied] = (0, import_react3.useState)(false);
100
105
  const [spinning, setSpinning] = (0, import_react3.useState)(false);
106
+ (0, import_react3.useEffect)(() => {
107
+ (0, import_diagnostics.ensureDeclarativeFocusStyles)();
108
+ }, []);
101
109
  (0, import_react3.useEffect)(() => {
102
110
  if (startCollapsed) {
103
111
  visibility.setCollapsed(true);
@@ -715,6 +723,8 @@ function useFormSubmitBlockers(options) {
715
723
  }
716
724
 
717
725
  // src/declarative-form.tsx
726
+ var import_diagnostics5 = require("@tooluminati/diagnostics");
727
+ var import_diagnostics6 = require("@tooluminati/diagnostics");
718
728
  var import_jsx_runtime4 = require("react/jsx-runtime");
719
729
  function WebMcpForm({
720
730
  toolName,
@@ -766,18 +776,26 @@ function WebMcpTextarea(props) {
766
776
  }
767
777
  function useAgentInvokedSubmit(handler) {
768
778
  return (event) => {
769
- const submitEvent = event.nativeEvent;
770
- if (submitEvent.agentInvoked) {
779
+ if ((0, import_diagnostics5.isAgentInvokedSubmit)(event.nativeEvent)) {
771
780
  handler(event);
772
781
  }
773
782
  };
774
783
  }
784
+ function useAgentSubmitRespondWith(getResult) {
785
+ return (event) => {
786
+ const nativeEvent = event.nativeEvent;
787
+ if (!(0, import_diagnostics5.isAgentInvokedSubmit)(nativeEvent) || typeof nativeEvent.respondWith !== "function") {
788
+ return;
789
+ }
790
+ (0, import_diagnostics5.respondWithAgentResult)(nativeEvent, Promise.resolve().then(getResult));
791
+ };
792
+ }
775
793
  function useDeclarativeFormToolEvents(_options = {}) {
776
794
  }
777
795
 
778
796
  // src/useTroubleshootingPanel.ts
779
797
  var import_react11 = require("react");
780
- var import_diagnostics5 = require("@tooluminati/diagnostics");
798
+ var import_diagnostics7 = require("@tooluminati/diagnostics");
781
799
  function useTroubleshootingPanel() {
782
800
  const { viewModel } = useWebMcpTroubleshootingContext();
783
801
  const [snapshot, setSnapshot] = (0, import_react11.useState)(
@@ -792,7 +810,7 @@ function useTroubleshootingPanel() {
792
810
  snapshot,
793
811
  panelState: snapshot.panelState,
794
812
  refresh: () => setSnapshot(viewModel.refresh()),
795
- copyDiagnostics: () => (0, import_diagnostics5.serializeTroubleshootingDiagnostics)(snapshot)
813
+ copyDiagnostics: () => (0, import_diagnostics7.serializeTroubleshootingDiagnostics)(snapshot)
796
814
  };
797
815
  }
798
816
  function useTroubleshootingPanelVisibility() {
@@ -808,6 +826,7 @@ function useTroubleshootingPanelVisibility() {
808
826
  }
809
827
  // Annotate the CommonJS export names for ESM import in node:
810
828
  0 && (module.exports = {
829
+ WEBMCP_DECLARATIVE_FOCUS_STYLES,
811
830
  WebMcpErrorBoundary,
812
831
  WebMcpForm,
813
832
  WebMcpInput,
@@ -817,12 +836,16 @@ function useTroubleshootingPanelVisibility() {
817
836
  WebMcpTroubleshootingPanel,
818
837
  WebMcpTroubleshootingProvider,
819
838
  createFormSubmitBlockersProvider,
839
+ ensureDeclarativeFocusStyles,
820
840
  getPanelVisibilityController,
821
841
  hideWebMcpTroubleshootingPanel,
842
+ isAgentInvokedSubmit,
822
843
  resetPanelVisibilityController,
844
+ respondWithAgentResult,
823
845
  showWebMcpTroubleshootingPanel,
824
846
  toggleWebMcpTroubleshootingPanel,
825
847
  useAgentInvokedSubmit,
848
+ useAgentSubmitRespondWith,
826
849
  useDeclarativeFormToolEvents,
827
850
  useFormSubmitBlockers,
828
851
  useTanStackQueryWebMcpTools,
package/dist/index.js CHANGED
@@ -51,7 +51,8 @@ function useWebMcpTroubleshootingContext() {
51
51
  import { useEffect, useMemo, useState } from "react";
52
52
  import {
53
53
  filterPanelEvents,
54
- serializeTroubleshootingDiagnostics
54
+ serializeTroubleshootingDiagnostics,
55
+ ensureDeclarativeFocusStyles
55
56
  } from "@tooluminati/diagnostics";
56
57
  import { jsx, jsxs } from "react/jsx-runtime";
57
58
  var PALETTE = {
@@ -82,6 +83,9 @@ function WebMcpTroubleshootingPanel({
82
83
  const [openErrors, setOpenErrors] = useState({});
83
84
  const [copied, setCopied] = useState(false);
84
85
  const [spinning, setSpinning] = useState(false);
86
+ useEffect(() => {
87
+ ensureDeclarativeFocusStyles();
88
+ }, []);
85
89
  useEffect(() => {
86
90
  if (startCollapsed) {
87
91
  visibility.setCollapsed(true);
@@ -703,6 +707,16 @@ function useFormSubmitBlockers(options) {
703
707
  }
704
708
 
705
709
  // src/declarative-form.tsx
710
+ import {
711
+ isAgentInvokedSubmit,
712
+ respondWithAgentResult
713
+ } from "@tooluminati/diagnostics";
714
+ import {
715
+ isAgentInvokedSubmit as isAgentInvokedSubmit2,
716
+ respondWithAgentResult as respondWithAgentResult2,
717
+ WEBMCP_DECLARATIVE_FOCUS_STYLES,
718
+ ensureDeclarativeFocusStyles as ensureDeclarativeFocusStyles2
719
+ } from "@tooluminati/diagnostics";
706
720
  import { jsx as jsx4 } from "react/jsx-runtime";
707
721
  function WebMcpForm({
708
722
  toolName,
@@ -754,12 +768,20 @@ function WebMcpTextarea(props) {
754
768
  }
755
769
  function useAgentInvokedSubmit(handler) {
756
770
  return (event) => {
757
- const submitEvent = event.nativeEvent;
758
- if (submitEvent.agentInvoked) {
771
+ if (isAgentInvokedSubmit(event.nativeEvent)) {
759
772
  handler(event);
760
773
  }
761
774
  };
762
775
  }
776
+ function useAgentSubmitRespondWith(getResult) {
777
+ return (event) => {
778
+ const nativeEvent = event.nativeEvent;
779
+ if (!isAgentInvokedSubmit(nativeEvent) || typeof nativeEvent.respondWith !== "function") {
780
+ return;
781
+ }
782
+ respondWithAgentResult(nativeEvent, Promise.resolve().then(getResult));
783
+ };
784
+ }
763
785
  function useDeclarativeFormToolEvents(_options = {}) {
764
786
  }
765
787
 
@@ -797,6 +819,7 @@ function useTroubleshootingPanelVisibility() {
797
819
  };
798
820
  }
799
821
  export {
822
+ WEBMCP_DECLARATIVE_FOCUS_STYLES,
800
823
  WebMcpErrorBoundary,
801
824
  WebMcpForm,
802
825
  WebMcpInput,
@@ -806,12 +829,16 @@ export {
806
829
  WebMcpTroubleshootingPanel,
807
830
  WebMcpTroubleshootingProvider,
808
831
  createFormSubmitBlockersProvider,
832
+ ensureDeclarativeFocusStyles2 as ensureDeclarativeFocusStyles,
809
833
  getPanelVisibilityController,
810
834
  hideWebMcpTroubleshootingPanel,
835
+ isAgentInvokedSubmit2 as isAgentInvokedSubmit,
811
836
  resetPanelVisibilityController,
837
+ respondWithAgentResult2 as respondWithAgentResult,
812
838
  showWebMcpTroubleshootingPanel,
813
839
  toggleWebMcpTroubleshootingPanel,
814
840
  useAgentInvokedSubmit,
841
+ useAgentSubmitRespondWith,
815
842
  useDeclarativeFormToolEvents,
816
843
  useFormSubmitBlockers,
817
844
  useTanStackQueryWebMcpTools,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tooluminati/react-troubleshooting",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "React troubleshooting bundle with timeline, blockers, and dev panel.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -17,12 +17,12 @@
17
17
  }
18
18
  },
19
19
  "dependencies": {
20
- "@tooluminati/core": "0.1.0",
21
- "@tooluminati/react": "0.1.0",
22
- "@tooluminati/diagnostics": "0.1.0",
23
- "@tooluminati/policies": "0.1.0",
24
- "@tooluminati/state": "0.1.0",
25
- "@tooluminati/forms": "0.1.0"
20
+ "@tooluminati/core": "0.2.0",
21
+ "@tooluminati/diagnostics": "0.2.0",
22
+ "@tooluminati/policies": "0.2.0",
23
+ "@tooluminati/state": "0.2.0",
24
+ "@tooluminati/forms": "0.2.0",
25
+ "@tooluminati/react": "0.2.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=18.0.0",