@tooluminati/react-troubleshooting 0.1.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.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/dist/WebMcpErrorBoundary.d.ts +8 -0
  3. package/dist/WebMcpErrorBoundary.d.ts.map +1 -0
  4. package/dist/WebMcpErrorBoundary.js +29 -0
  5. package/dist/WebMcpTroubleshootingContext.d.ts +12 -0
  6. package/dist/WebMcpTroubleshootingContext.d.ts.map +1 -0
  7. package/dist/WebMcpTroubleshootingContext.js +9 -0
  8. package/dist/WebMcpTroubleshootingPanel.d.ts +9 -0
  9. package/dist/WebMcpTroubleshootingPanel.d.ts.map +1 -0
  10. package/dist/WebMcpTroubleshootingPanel.js +170 -0
  11. package/dist/WebMcpTroubleshootingProvider.d.ts +23 -0
  12. package/dist/WebMcpTroubleshootingProvider.d.ts.map +1 -0
  13. package/dist/WebMcpTroubleshootingProvider.js +106 -0
  14. package/dist/declarative-form.d.ts +23 -0
  15. package/dist/declarative-form.d.ts.map +1 -0
  16. package/dist/declarative-form.js +33 -0
  17. package/dist/index.cjs +833 -0
  18. package/dist/index.d.ts +11 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +822 -0
  21. package/dist/panel-visibility.d.ts +8 -0
  22. package/dist/panel-visibility.d.ts.map +1 -0
  23. package/dist/panel-visibility.js +23 -0
  24. package/dist/useFormSubmitBlockers.d.ts +11 -0
  25. package/dist/useFormSubmitBlockers.d.ts.map +1 -0
  26. package/dist/useFormSubmitBlockers.js +35 -0
  27. package/dist/useTanStackQueryWebMcpTools.d.ts +9 -0
  28. package/dist/useTanStackQueryWebMcpTools.d.ts.map +1 -0
  29. package/dist/useTanStackQueryWebMcpTools.js +16 -0
  30. package/dist/useTroubleshootingPanel.d.ts +14 -0
  31. package/dist/useTroubleshootingPanel.d.ts.map +1 -0
  32. package/dist/useTroubleshootingPanel.js +29 -0
  33. package/dist/webmcp-declarative-attributes.d.ts +20 -0
  34. package/dist/webmcp-declarative-attributes.d.ts.map +1 -0
  35. package/dist/webmcp-declarative-attributes.js +2 -0
  36. package/package.json +67 -0
@@ -0,0 +1,8 @@
1
+ import { type TroubleshootingPanelVisibilityController } from '@tooluminati/diagnostics';
2
+ export declare function getPanelVisibilityController(): TroubleshootingPanelVisibilityController;
3
+ export declare function wirePanelVisibilityController(next: TroubleshootingPanelVisibilityController): void;
4
+ export declare function showWebMcpTroubleshootingPanel(): void;
5
+ export declare function hideWebMcpTroubleshootingPanel(): void;
6
+ export declare function toggleWebMcpTroubleshootingPanel(): void;
7
+ export declare function resetPanelVisibilityController(): void;
8
+ //# sourceMappingURL=panel-visibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel-visibility.d.ts","sourceRoot":"","sources":["../src/panel-visibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,wCAAwC,EAC9C,MAAM,0BAA0B,CAAC;AAIlC,wBAAgB,4BAA4B,IAAI,wCAAwC,CAKvF;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,wCAAwC,GAC7C,IAAI,CAEN;AAED,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAED,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AAED,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD;AAED,wBAAgB,8BAA8B,IAAI,IAAI,CAErD"}
@@ -0,0 +1,23 @@
1
+ import { createTroubleshootingPanelVisibilityController, } from '@tooluminati/diagnostics';
2
+ let controller;
3
+ export function getPanelVisibilityController() {
4
+ if (!controller) {
5
+ controller = createTroubleshootingPanelVisibilityController();
6
+ }
7
+ return controller;
8
+ }
9
+ export function wirePanelVisibilityController(next) {
10
+ controller = next;
11
+ }
12
+ export function showWebMcpTroubleshootingPanel() {
13
+ getPanelVisibilityController().show();
14
+ }
15
+ export function hideWebMcpTroubleshootingPanel() {
16
+ getPanelVisibilityController().hide();
17
+ }
18
+ export function toggleWebMcpTroubleshootingPanel() {
19
+ getPanelVisibilityController().toggle();
20
+ }
21
+ export function resetPanelVisibilityController() {
22
+ controller = undefined;
23
+ }
@@ -0,0 +1,11 @@
1
+ import type { ActionAvailabilityProvider } from '@tooluminati/diagnostics';
2
+ import type { FormDiagnosticSummary } from '@tooluminati/forms';
3
+ export interface FormSubmitBlockersOptions {
4
+ actionId: string;
5
+ label: string;
6
+ getFormSummary: () => FormDiagnosticSummary;
7
+ getExtraReasons?: () => string[];
8
+ }
9
+ export declare function createFormSubmitBlockersProvider(options: FormSubmitBlockersOptions): ActionAvailabilityProvider;
10
+ export declare function useFormSubmitBlockers(options: FormSubmitBlockersOptions): ActionAvailabilityProvider;
11
+ //# sourceMappingURL=useFormSubmitBlockers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormSubmitBlockers.d.ts","sourceRoot":"","sources":["../src/useFormSubmitBlockers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,0BAA0B,EAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAIhE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,qBAAqB,CAAC;IAC5C,eAAe,CAAC,EAAE,MAAM,MAAM,EAAE,CAAC;CAClC;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,yBAAyB,GACjC,0BAA0B,CA4B5B;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,yBAAyB,GACjC,0BAA0B,CAO5B"}
@@ -0,0 +1,35 @@
1
+ import { useMemo } from 'react';
2
+ import { useWebMcpTool } from '@tooluminati/react';
3
+ import { createActionAvailabilityTool } from '@tooluminati/diagnostics';
4
+ export function createFormSubmitBlockersProvider(options) {
5
+ return {
6
+ getActionAvailability(actionId) {
7
+ if (actionId !== options.actionId) {
8
+ return undefined;
9
+ }
10
+ const summary = options.getFormSummary();
11
+ const reasons = [
12
+ ...summary.errors.map((e) => `${e.path}: ${e.message}`),
13
+ ...(options.getExtraReasons?.() ?? []),
14
+ ];
15
+ if (summary.submitting) {
16
+ reasons.push('Form is submitting.');
17
+ }
18
+ return {
19
+ actionId,
20
+ label: options.label,
21
+ available: reasons.length === 0,
22
+ reasons,
23
+ };
24
+ },
25
+ listActions() {
26
+ const action = createFormSubmitBlockersProvider(options).getActionAvailability(options.actionId);
27
+ return action ? [action] : [];
28
+ },
29
+ };
30
+ }
31
+ export function useFormSubmitBlockers(options) {
32
+ const provider = useMemo(() => createFormSubmitBlockersProvider(options), [options]);
33
+ useWebMcpTool(createActionAvailabilityTool(provider), [provider]);
34
+ return provider;
35
+ }
@@ -0,0 +1,9 @@
1
+ import { type QueryClientLike } from '@tooluminati/state';
2
+ export interface TanStackQueryWebMcpToolsOptions {
3
+ allowKeys: unknown[];
4
+ includeDataShape?: boolean;
5
+ includeData?: boolean;
6
+ name?: string;
7
+ }
8
+ export declare function useTanStackQueryWebMcpTools(queryClient: QueryClientLike, options: TanStackQueryWebMcpToolsOptions): void;
9
+ //# sourceMappingURL=useTanStackQueryWebMcpTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTanStackQueryWebMcpTools.d.ts","sourceRoot":"","sources":["../src/useTanStackQueryWebMcpTools.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,eAAe,EAC5B,OAAO,EAAE,+BAA+B,GACvC,IAAI,CAmBN"}
@@ -0,0 +1,16 @@
1
+ import { useMemo } from 'react';
2
+ import { useWebMcpTools } from '@tooluminati/react';
3
+ import { createQueryCacheSummaryTool, } from '@tooluminati/state';
4
+ export function useTanStackQueryWebMcpTools(queryClient, options) {
5
+ const { allowKeys, includeDataShape, includeData, name, } = options;
6
+ const tool = useMemo(() => {
7
+ return createQueryCacheSummaryTool({
8
+ queryClient,
9
+ allowKeys,
10
+ ...(includeDataShape !== undefined ? { includeDataShape } : {}),
11
+ ...(includeData !== undefined ? { includeData } : {}),
12
+ ...(name ? { name } : {}),
13
+ });
14
+ }, [queryClient, allowKeys, includeDataShape, includeData, name]);
15
+ useWebMcpTools([tool], [tool], { source: 'diagnostic' });
16
+ }
@@ -0,0 +1,14 @@
1
+ import { type TroubleshootingPanelSnapshot } from '@tooluminati/diagnostics';
2
+ export declare function useTroubleshootingPanel(): {
3
+ snapshot: TroubleshootingPanelSnapshot;
4
+ panelState: import("@tooluminati/diagnostics").TroubleshootingPanelState;
5
+ refresh: () => void;
6
+ copyDiagnostics: () => string;
7
+ };
8
+ export declare function useTroubleshootingPanelVisibility(): {
9
+ visibility: import("@tooluminati/diagnostics").TroubleshootingPanelVisibilityController;
10
+ isPanelEnabled: boolean;
11
+ visible: boolean;
12
+ collapsed: boolean;
13
+ };
14
+ //# sourceMappingURL=useTroubleshootingPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTroubleshootingPanel.d.ts","sourceRoot":"","sources":["../src/useTroubleshootingPanel.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,0BAA0B,CAAC;AAGlC,wBAAgB,uBAAuB;;;;;EAkBtC;AAED,wBAAgB,iCAAiC;;;;;EAYhD"}
@@ -0,0 +1,29 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { serializeTroubleshootingDiagnostics, } from '@tooluminati/diagnostics';
3
+ import { useWebMcpTroubleshootingContext } from './WebMcpTroubleshootingContext';
4
+ export function useTroubleshootingPanel() {
5
+ const { viewModel } = useWebMcpTroubleshootingContext();
6
+ const [snapshot, setSnapshot] = useState(() => viewModel.refresh());
7
+ useEffect(() => {
8
+ const refresh = () => setSnapshot(viewModel.refresh());
9
+ refresh();
10
+ return viewModel.subscribe(refresh);
11
+ }, [viewModel]);
12
+ return {
13
+ snapshot,
14
+ panelState: snapshot.panelState,
15
+ refresh: () => setSnapshot(viewModel.refresh()),
16
+ copyDiagnostics: () => serializeTroubleshootingDiagnostics(snapshot),
17
+ };
18
+ }
19
+ export function useTroubleshootingPanelVisibility() {
20
+ const { visibility, isPanelEnabled } = useWebMcpTroubleshootingContext();
21
+ const [, bump] = useState(0);
22
+ useEffect(() => visibility.subscribe(() => bump((n) => n + 1)), [visibility]);
23
+ return {
24
+ visibility,
25
+ isPanelEnabled,
26
+ visible: visibility.visible,
27
+ collapsed: visibility.collapsed,
28
+ };
29
+ }
@@ -0,0 +1,20 @@
1
+ import 'react';
2
+ declare module 'react' {
3
+ interface FormHTMLAttributes<T> {
4
+ toolname?: string | undefined;
5
+ tooldescription?: string | undefined;
6
+ /** Presence attribute; set to "" when enabled. */
7
+ toolautosubmit?: '' | undefined;
8
+ }
9
+ interface InputHTMLAttributes<T> {
10
+ toolparamdescription?: string | undefined;
11
+ }
12
+ interface SelectHTMLAttributes<T> {
13
+ toolparamdescription?: string | undefined;
14
+ }
15
+ interface TextareaHTMLAttributes<T> {
16
+ toolparamdescription?: string | undefined;
17
+ }
18
+ }
19
+ export {};
20
+ //# sourceMappingURL=webmcp-declarative-attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webmcp-declarative-attributes.d.ts","sourceRoot":"","sources":["../src/webmcp-declarative-attributes.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,CAAC;AAEf,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,kBAAkB,CAAC,CAAC;QAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC9B,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACrC,kDAAkD;QAClD,cAAc,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC;KACjC;IAED,UAAU,mBAAmB,CAAC,CAAC;QAC7B,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC3C;IAED,UAAU,oBAAoB,CAAC,CAAC;QAC9B,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC3C;IAED,UAAU,sBAAsB,CAAC,CAAC;QAChC,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC3C;CACF;AAED,OAAO,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars -- merge React HTML attribute interfaces */
2
+ import 'react';
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@tooluminati/react-troubleshooting",
3
+ "version": "0.1.0",
4
+ "description": "React troubleshooting bundle with timeline, blockers, and dev panel.",
5
+ "type": "module",
6
+ "sideEffects": [
7
+ "**/webmcp-declarative-attributes.*"
8
+ ],
9
+ "main": "./dist/index.cjs",
10
+ "module": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/index.cjs"
17
+ }
18
+ },
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"
26
+ },
27
+ "peerDependencies": {
28
+ "react": ">=18.0.0",
29
+ "react-dom": ">=18.0.0",
30
+ "@tanstack/react-query": ">=5.0.0"
31
+ },
32
+ "peerDependenciesMeta": {
33
+ "@tanstack/react-query": {
34
+ "optional": true
35
+ }
36
+ },
37
+ "files": [
38
+ "dist"
39
+ ],
40
+ "license": "MIT",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/jitterbox/Tooluminati.git",
47
+ "directory": "packages/react-troubleshooting"
48
+ },
49
+ "keywords": [
50
+ "tooluminati",
51
+ "webmcp",
52
+ "react",
53
+ "troubleshooting",
54
+ "diagnostics"
55
+ ],
56
+ "bugs": {
57
+ "url": "https://github.com/jitterbox/Tooluminati/issues"
58
+ },
59
+ "homepage": "https://github.com/jitterbox/Tooluminati#readme",
60
+ "engines": {
61
+ "node": ">=18"
62
+ },
63
+ "scripts": {
64
+ "build": "tsup src/index.ts --format esm,cjs && tsc -p tsconfig.json --emitDeclarationOnly",
65
+ "typecheck": "tsc --noEmit"
66
+ }
67
+ }