@sqaitech/visualizer 0.30.10

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 (148) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -0
  3. package/dist/es/component/blackboard/index.css +33 -0
  4. package/dist/es/component/blackboard/index.mjs +278 -0
  5. package/dist/es/component/config-selector/index.mjs +104 -0
  6. package/dist/es/component/context-preview/index.mjs +38 -0
  7. package/dist/es/component/env-config/index.mjs +112 -0
  8. package/dist/es/component/env-config-reminder/index.css +22 -0
  9. package/dist/es/component/env-config-reminder/index.mjs +28 -0
  10. package/dist/es/component/form-field/index.mjs +163 -0
  11. package/dist/es/component/history-selector/index.css +135 -0
  12. package/dist/es/component/history-selector/index.mjs +170 -0
  13. package/dist/es/component/index.mjs +1 -0
  14. package/dist/es/component/logo/index.css +13 -0
  15. package/dist/es/component/logo/index.mjs +20 -0
  16. package/dist/es/component/misc/index.mjs +94 -0
  17. package/dist/es/component/nav-actions/index.mjs +32 -0
  18. package/dist/es/component/nav-actions/style.css +35 -0
  19. package/dist/es/component/player/index.css +185 -0
  20. package/dist/es/component/player/index.mjs +856 -0
  21. package/dist/es/component/playground/index.css +431 -0
  22. package/dist/es/component/playground/index.mjs +8 -0
  23. package/dist/es/component/playground/playground-demo-ui-context.json +290 -0
  24. package/dist/es/component/playground-result/index.css +34 -0
  25. package/dist/es/component/playground-result/index.mjs +62 -0
  26. package/dist/es/component/prompt-input/index.css +391 -0
  27. package/dist/es/component/prompt-input/index.mjs +730 -0
  28. package/dist/es/component/service-mode-control/index.mjs +105 -0
  29. package/dist/es/component/shiny-text/index.css +75 -0
  30. package/dist/es/component/shiny-text/index.mjs +15 -0
  31. package/dist/es/component/universal-playground/index.css +341 -0
  32. package/dist/es/component/universal-playground/index.mjs +302 -0
  33. package/dist/es/component/universal-playground/providers/context-provider.mjs +52 -0
  34. package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +207 -0
  35. package/dist/es/component/universal-playground/providers/storage-provider.mjs +210 -0
  36. package/dist/es/hooks/usePlaygroundExecution.mjs +180 -0
  37. package/dist/es/hooks/usePlaygroundState.mjs +203 -0
  38. package/dist/es/hooks/useSafeOverrideAIConfig.mjs +24 -0
  39. package/dist/es/hooks/useServerValid.mjs +30 -0
  40. package/dist/es/icons/avatar.mjs +28 -0
  41. package/dist/es/icons/close.mjs +19 -0
  42. package/dist/es/icons/global-perspective.mjs +16 -0
  43. package/dist/es/icons/history.mjs +30 -0
  44. package/dist/es/icons/magnifying-glass.mjs +39 -0
  45. package/dist/es/icons/player-setting.mjs +26 -0
  46. package/dist/es/icons/setting.mjs +20 -0
  47. package/dist/es/icons/show-marker.mjs +16 -0
  48. package/dist/es/index.mjs +25 -0
  49. package/dist/es/store/history.mjs +89 -0
  50. package/dist/es/store/store.mjs +186 -0
  51. package/dist/es/types.mjs +70 -0
  52. package/dist/es/utils/color.mjs +35 -0
  53. package/dist/es/utils/constants.mjs +99 -0
  54. package/dist/es/utils/index.mjs +10 -0
  55. package/dist/es/utils/pixi-loader.mjs +16 -0
  56. package/dist/es/utils/playground-utils.mjs +67 -0
  57. package/dist/es/utils/replay-scripts.mjs +312 -0
  58. package/dist/lib/component/blackboard/index.css +33 -0
  59. package/dist/lib/component/blackboard/index.js +321 -0
  60. package/dist/lib/component/config-selector/index.js +148 -0
  61. package/dist/lib/component/context-preview/index.js +83 -0
  62. package/dist/lib/component/env-config/index.js +146 -0
  63. package/dist/lib/component/env-config-reminder/index.css +22 -0
  64. package/dist/lib/component/env-config-reminder/index.js +62 -0
  65. package/dist/lib/component/form-field/index.js +209 -0
  66. package/dist/lib/component/history-selector/index.css +135 -0
  67. package/dist/lib/component/history-selector/index.js +216 -0
  68. package/dist/lib/component/index.js +60 -0
  69. package/dist/lib/component/logo/index.css +13 -0
  70. package/dist/lib/component/logo/index.js +57 -0
  71. package/dist/lib/component/misc/index.js +150 -0
  72. package/dist/lib/component/nav-actions/index.js +66 -0
  73. package/dist/lib/component/nav-actions/style.css +35 -0
  74. package/dist/lib/component/player/index.css +185 -0
  75. package/dist/lib/component/player/index.js +902 -0
  76. package/dist/lib/component/playground/index.css +431 -0
  77. package/dist/lib/component/playground/index.js +113 -0
  78. package/dist/lib/component/playground/playground-demo-ui-context.json +290 -0
  79. package/dist/lib/component/playground-result/index.css +34 -0
  80. package/dist/lib/component/playground-result/index.js +106 -0
  81. package/dist/lib/component/prompt-input/index.css +391 -0
  82. package/dist/lib/component/prompt-input/index.js +774 -0
  83. package/dist/lib/component/service-mode-control/index.js +139 -0
  84. package/dist/lib/component/shiny-text/index.css +75 -0
  85. package/dist/lib/component/shiny-text/index.js +49 -0
  86. package/dist/lib/component/universal-playground/index.css +341 -0
  87. package/dist/lib/component/universal-playground/index.js +350 -0
  88. package/dist/lib/component/universal-playground/providers/context-provider.js +95 -0
  89. package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +247 -0
  90. package/dist/lib/component/universal-playground/providers/storage-provider.js +268 -0
  91. package/dist/lib/hooks/usePlaygroundExecution.js +214 -0
  92. package/dist/lib/hooks/usePlaygroundState.js +237 -0
  93. package/dist/lib/hooks/useSafeOverrideAIConfig.js +61 -0
  94. package/dist/lib/hooks/useServerValid.js +64 -0
  95. package/dist/lib/icons/avatar.js +62 -0
  96. package/dist/lib/icons/close.js +53 -0
  97. package/dist/lib/icons/global-perspective.js +50 -0
  98. package/dist/lib/icons/history.js +64 -0
  99. package/dist/lib/icons/magnifying-glass.js +73 -0
  100. package/dist/lib/icons/player-setting.js +60 -0
  101. package/dist/lib/icons/setting.js +54 -0
  102. package/dist/lib/icons/show-marker.js +50 -0
  103. package/dist/lib/index.js +187 -0
  104. package/dist/lib/store/history.js +96 -0
  105. package/dist/lib/store/store.js +196 -0
  106. package/dist/lib/types.js +116 -0
  107. package/dist/lib/utils/color.js +75 -0
  108. package/dist/lib/utils/constants.js +154 -0
  109. package/dist/lib/utils/index.js +63 -0
  110. package/dist/lib/utils/pixi-loader.js +56 -0
  111. package/dist/lib/utils/playground-utils.js +110 -0
  112. package/dist/lib/utils/replay-scripts.js +355 -0
  113. package/dist/types/component/blackboard/index.d.ts +15 -0
  114. package/dist/types/component/config-selector/index.d.ts +9 -0
  115. package/dist/types/component/context-preview/index.d.ts +9 -0
  116. package/dist/types/component/env-config/index.d.ts +6 -0
  117. package/dist/types/component/env-config-reminder/index.d.ts +6 -0
  118. package/dist/types/component/form-field/index.d.ts +17 -0
  119. package/dist/types/component/history-selector/index.d.ts +10 -0
  120. package/dist/types/component/index.d.ts +1 -0
  121. package/dist/types/component/logo/index.d.ts +5 -0
  122. package/dist/types/component/misc/index.d.ts +6 -0
  123. package/dist/types/component/nav-actions/index.d.ts +10 -0
  124. package/dist/types/component/player/index.d.ts +13 -0
  125. package/dist/types/component/playground/index.d.ts +7 -0
  126. package/dist/types/component/playground-result/index.d.ts +20 -0
  127. package/dist/types/component/prompt-input/index.d.ts +22 -0
  128. package/dist/types/component/service-mode-control/index.d.ts +6 -0
  129. package/dist/types/component/shiny-text/index.d.ts +12 -0
  130. package/dist/types/component/universal-playground/index.d.ts +4 -0
  131. package/dist/types/component/universal-playground/providers/context-provider.d.ts +37 -0
  132. package/dist/types/component/universal-playground/providers/indexeddb-storage-provider.d.ts +71 -0
  133. package/dist/types/component/universal-playground/providers/storage-provider.d.ts +58 -0
  134. package/dist/types/hooks/usePlaygroundExecution.d.ts +10 -0
  135. package/dist/types/hooks/usePlaygroundState.d.ts +26 -0
  136. package/dist/types/hooks/useSafeOverrideAIConfig.d.ts +16 -0
  137. package/dist/types/hooks/useServerValid.d.ts +1 -0
  138. package/dist/types/index.d.ts +27 -0
  139. package/dist/types/store/history.d.ts +16 -0
  140. package/dist/types/store/store.d.ts +36 -0
  141. package/dist/types/types.d.ts +161 -0
  142. package/dist/types/utils/color.d.ts +4 -0
  143. package/dist/types/utils/constants.d.ts +74 -0
  144. package/dist/types/utils/index.d.ts +4 -0
  145. package/dist/types/utils/pixi-loader.d.ts +5 -0
  146. package/dist/types/utils/playground-utils.d.ts +6 -0
  147. package/dist/types/utils/replay-scripts.d.ts +34 -0
  148. package/package.json +85 -0
@@ -0,0 +1,19 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgClose = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: 18,
6
+ height: 16,
7
+ fill: "none",
8
+ viewBox: "0 0 18 16",
9
+ ...props,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ stroke: "#333",
12
+ strokeLinecap: "round",
13
+ strokeLinejoin: "round",
14
+ strokeWidth: 1.333,
15
+ d: "m3.124 2.667 11.162 10.666M3.124 13.333 14.286 2.667"
16
+ })
17
+ });
18
+ const icons_close = SvgClose;
19
+ export { icons_close as default };
@@ -0,0 +1,16 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgGlobalPerspective = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: 16,
6
+ height: 16,
7
+ fill: "none",
8
+ viewBox: "0 0 16 16",
9
+ ...props,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ fill: "#333",
12
+ d: "M1.333 13v-2.5a.667.667 0 0 1 1.334 0V13c0 .184.149.333.333.333h2.5a.667.667 0 0 1 0 1.334H3c-.92 0-1.667-.746-1.667-1.667m12 0v-2.5a.667.667 0 0 1 1.334 0V13c0 .92-.746 1.667-1.667 1.667h-2.5a.667.667 0 0 1 0-1.334H13a.333.333 0 0 0 .333-.333m-12-7.5V3c0-.92.747-1.667 1.667-1.667h2.5a.667.667 0 0 1 0 1.334H3A.333.333 0 0 0 2.667 3v2.5a.667.667 0 0 1-1.334 0m12 0V3A.333.333 0 0 0 13 2.667h-2.5a.667.667 0 0 1 0-1.334H13c.92 0 1.667.747 1.667 1.667v2.5a.667.667 0 0 1-1.334 0M5.667 10.333h4.666V5.667H5.667zm6 .167c0 .644-.523 1.167-1.167 1.167h-5A1.167 1.167 0 0 1 4.333 10.5v-5c0-.644.523-1.167 1.167-1.167h5c.644 0 1.167.523 1.167 1.167z"
13
+ })
14
+ });
15
+ const global_perspective = SvgGlobalPerspective;
16
+ export { global_perspective as default };
@@ -0,0 +1,30 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgHistory = (props)=>/*#__PURE__*/ jsxs("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: 25,
6
+ height: 25,
7
+ fill: "none",
8
+ viewBox: "0 0 25 25",
9
+ ...props,
10
+ children: [
11
+ /*#__PURE__*/ jsx("path", {
12
+ stroke: "#000",
13
+ strokeLinecap: "round",
14
+ strokeLinejoin: "round",
15
+ strokeOpacity: 0.85,
16
+ strokeWidth: 1.33,
17
+ d: "M6.63 9.021c-2.862 6.126 2.197 10.501 6.063 10.501a7 7 0 1 0-6.063-10.5"
18
+ }),
19
+ /*#__PURE__*/ jsx("path", {
20
+ stroke: "#000",
21
+ strokeLinecap: "round",
22
+ strokeLinejoin: "round",
23
+ strokeOpacity: 0.85,
24
+ strokeWidth: 1.33,
25
+ d: "M12.695 8.322v4.203l2.967 2.968"
26
+ })
27
+ ]
28
+ });
29
+ const icons_history = SvgHistory;
30
+ export { icons_history as default };
@@ -0,0 +1,39 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgMagnifyingGlass = (props)=>/*#__PURE__*/ jsxs("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: 19,
6
+ height: 19,
7
+ fill: "none",
8
+ viewBox: "0 0 19 19",
9
+ ...props,
10
+ children: [
11
+ /*#__PURE__*/ jsxs("g", {
12
+ stroke: "#000",
13
+ strokeLinejoin: "round",
14
+ strokeOpacity: 0.65,
15
+ strokeWidth: 1.5,
16
+ clipPath: "url(#magnifying-glass_svg__a)",
17
+ children: [
18
+ /*#__PURE__*/ jsx("path", {
19
+ d: "M8.397 14.29a6.375 6.375 0 1 0 0-12.75 6.375 6.375 0 0 0 0 12.75Z"
20
+ }),
21
+ /*#__PURE__*/ jsx("path", {
22
+ strokeLinecap: "round",
23
+ d: "M10.519 5.42a3 3 0 0 0-2.122-.88 3 3 0 0 0-2.121.88M12.98 12.499l3.182 3.182"
24
+ })
25
+ ]
26
+ }),
27
+ /*#__PURE__*/ jsx("defs", {
28
+ children: /*#__PURE__*/ jsx("clipPath", {
29
+ id: "magnifying-glass_svg__a",
30
+ children: /*#__PURE__*/ jsx("path", {
31
+ fill: "#fff",
32
+ d: "M.522.04h18v18h-18z"
33
+ })
34
+ })
35
+ })
36
+ ]
37
+ });
38
+ const magnifying_glass = SvgMagnifyingGlass;
39
+ export { magnifying_glass as default };
@@ -0,0 +1,26 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgPlayerSetting = (props)=>/*#__PURE__*/ jsxs("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: 16,
6
+ height: 16,
7
+ fill: "none",
8
+ viewBox: "0 0 16 16",
9
+ ...props,
10
+ children: [
11
+ /*#__PURE__*/ jsx("path", {
12
+ stroke: "#333",
13
+ strokeLinejoin: "round",
14
+ strokeWidth: 1.333,
15
+ d: "M11.333 13.667 14.667 8l-3.334-5.667H4.667L1.333 8l3.334 5.667z"
16
+ }),
17
+ /*#__PURE__*/ jsx("path", {
18
+ stroke: "#333",
19
+ strokeLinejoin: "round",
20
+ strokeWidth: 1.333,
21
+ d: "M8 9.667a1.667 1.667 0 1 0 0-3.334 1.667 1.667 0 0 0 0 3.334Z"
22
+ })
23
+ ]
24
+ });
25
+ const player_setting = SvgPlayerSetting;
26
+ export { player_setting as default };
@@ -0,0 +1,20 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgSetting = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: 27,
6
+ height: 27,
7
+ fill: "none",
8
+ viewBox: "0 0 27 27",
9
+ ...props,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ stroke: "#000",
12
+ strokeLinecap: "round",
13
+ strokeLinejoin: "round",
14
+ strokeOpacity: 0.85,
15
+ strokeWidth: 1.333,
16
+ d: "M19.527 8.855h-2M14.86 7.522v2.667M14.86 8.855H7.527M10.194 13.522H7.527M12.86 12.189v2.666M20.193 13.522H12.86M19.527 18.189h-2M14.86 16.855v2.667M14.86 18.189H7.527"
17
+ })
18
+ });
19
+ const setting = SvgSetting;
20
+ export { setting as default };
@@ -0,0 +1,16 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgShowMarker = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: 16,
6
+ height: 16,
7
+ fill: "none",
8
+ viewBox: "0 0 16 16",
9
+ ...props,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ fill: "#333",
12
+ d: "M13 1.835a2.165 2.165 0 0 1 .665 4.225v3.88a2.166 2.166 0 1 1-2.725 2.725H5.06a2.165 2.165 0 1 1-2.725-2.726V6.06A2.165 2.165 0 1 1 5.06 3.336h5.88c.281-.87 1.097-1.5 2.06-1.5m-10 9.33a.835.835 0 1 0 0 1.67.835.835 0 0 0 0-1.67m10 0a.835.835 0 1 0 0 1.67.835.835 0 0 0 0-1.67m-7.94-6.5A2.17 2.17 0 0 1 3.665 6.06v3.88c.66.213 1.181.734 1.395 1.395h5.88a2.17 2.17 0 0 1 1.395-1.396V6.06a2.17 2.17 0 0 1-1.395-1.394zM3 3.165a.835.835 0 1 0 0 1.67.835.835 0 0 0 0-1.67m10 0a.835.835 0 1 0 0 1.67.835.835 0 0 0 0-1.67"
13
+ })
14
+ });
15
+ const show_marker = SvgShowMarker;
16
+ export { show_marker as default };
@@ -0,0 +1,25 @@
1
+ import "./component/playground/index.css";
2
+ import "./component/universal-playground/index.css";
3
+ import { allScriptsFromDump, generateAnimationScripts } from "./utils/replay-scripts.mjs";
4
+ import { useEnvConfig } from "./store/store.mjs";
5
+ import { colorForName, globalThemeConfig, highlightColorForType } from "./utils/color.mjs";
6
+ import { EnvConfig } from "./component/env-config/index.mjs";
7
+ import { EnvConfigReminder } from "./component/env-config-reminder/index.mjs";
8
+ import { NavActions } from "./component/nav-actions/index.mjs";
9
+ import { Logo } from "./component/logo/index.mjs";
10
+ import { iconForStatus, timeCostStrElement } from "./component/misc/index.mjs";
11
+ import { useServerValid } from "./hooks/useServerValid.mjs";
12
+ import { safeOverrideAIConfig, useSafeOverrideAIConfig } from "./hooks/useSafeOverrideAIConfig.mjs";
13
+ import { PlaygroundResultView } from "./component/playground-result/index.mjs";
14
+ import { ServiceModeControl } from "./component/service-mode-control/index.mjs";
15
+ import { ContextPreview } from "./component/context-preview/index.mjs";
16
+ import { PromptInput } from "./component/prompt-input/index.mjs";
17
+ import { Player } from "./component/player/index.mjs";
18
+ import { Blackboard } from "./component/blackboard/index.mjs";
19
+ import { actionNameForType, getPlaceholderForType, staticAgentFromContext } from "./utils/playground-utils.mjs";
20
+ import { filterBase64Value, timeStr } from "./utils/index.mjs";
21
+ import shiny_text from "./component/shiny-text/index.mjs";
22
+ import universal_playground, { UniversalPlayground } from "./component/universal-playground/index.mjs";
23
+ import { IndexedDBStorageProvider, LocalStorageProvider, MemoryStorageProvider, NoOpStorageProvider, StorageType, createStorageProvider, detectBestStorageType } from "./component/universal-playground/providers/storage-provider.mjs";
24
+ import { AgentContextProvider, BaseContextProvider, NoOpContextProvider, StaticContextProvider } from "./component/universal-playground/providers/context-provider.mjs";
25
+ export { AgentContextProvider, BaseContextProvider, Blackboard, ContextPreview, EnvConfig, EnvConfigReminder, IndexedDBStorageProvider, LocalStorageProvider, Logo, MemoryStorageProvider, NavActions, NoOpContextProvider, NoOpStorageProvider, Player, PlaygroundResultView, PromptInput, ServiceModeControl, shiny_text as ShinyText, StaticContextProvider, StorageType, UniversalPlayground, universal_playground as UniversalPlaygroundDefault, actionNameForType, allScriptsFromDump, colorForName, createStorageProvider, detectBestStorageType, filterBase64Value, generateAnimationScripts, getPlaceholderForType, globalThemeConfig, highlightColorForType, iconForStatus, safeOverrideAIConfig, staticAgentFromContext, timeCostStrElement, timeStr, useEnvConfig, useSafeOverrideAIConfig, useServerValid };
@@ -0,0 +1,89 @@
1
+ import { create } from "zustand";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var external_zustand_namespaceObject = {};
25
+ __webpack_require__.r(external_zustand_namespaceObject);
26
+ __webpack_require__.d(external_zustand_namespaceObject, {
27
+ create: ()=>create
28
+ });
29
+ const { create: history_create } = external_zustand_namespaceObject;
30
+ const HISTORY_KEY = 'midscene-prompt-history-v2';
31
+ const LAST_SELECTED_TYPE_KEY = 'midscene-last-selected-type';
32
+ const getHistoryFromLocalStorage = ()=>{
33
+ const historyString = localStorage.getItem(HISTORY_KEY);
34
+ return historyString ? JSON.parse(historyString) : {};
35
+ };
36
+ const getLastSelectedType = ()=>localStorage.getItem(LAST_SELECTED_TYPE_KEY) || 'aiAction';
37
+ const setLastSelectedType = (type)=>{
38
+ localStorage.setItem(LAST_SELECTED_TYPE_KEY, type);
39
+ };
40
+ const useHistoryStore = history_create((set, get)=>({
41
+ history: getHistoryFromLocalStorage(),
42
+ lastSelectedType: getLastSelectedType(),
43
+ clearHistory: (type)=>{
44
+ const newHistory = {
45
+ ...get().history
46
+ };
47
+ delete newHistory[type];
48
+ set({
49
+ history: newHistory
50
+ });
51
+ localStorage.setItem(HISTORY_KEY, JSON.stringify(newHistory));
52
+ },
53
+ addHistory: (historyItem)=>{
54
+ const { type } = historyItem;
55
+ const currentHistory = get().history;
56
+ const typeHistory = currentHistory[type] || [];
57
+ const stringifiedNewItem = JSON.stringify({
58
+ prompt: historyItem.prompt,
59
+ params: historyItem.params
60
+ });
61
+ const newTypeHistory = [
62
+ historyItem,
63
+ ...typeHistory.filter((h)=>{
64
+ const stringifiedOldItem = JSON.stringify({
65
+ prompt: h.prompt,
66
+ params: h.params
67
+ });
68
+ return stringifiedOldItem !== stringifiedNewItem;
69
+ })
70
+ ];
71
+ if (newTypeHistory.length > 10) newTypeHistory.length = 10;
72
+ const newHistory = {
73
+ ...currentHistory,
74
+ [type]: newTypeHistory
75
+ };
76
+ set({
77
+ history: newHistory
78
+ });
79
+ localStorage.setItem(HISTORY_KEY, JSON.stringify(newHistory));
80
+ },
81
+ getHistoryForType: (type)=>get().history[type] || [],
82
+ setLastSelectedType: (type)=>{
83
+ set({
84
+ lastSelectedType: type
85
+ });
86
+ setLastSelectedType(type);
87
+ }
88
+ }));
89
+ export { useHistoryStore };
@@ -0,0 +1,186 @@
1
+ import { create } from "zustand";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var external_zustand_namespaceObject = {};
25
+ __webpack_require__.r(external_zustand_namespaceObject);
26
+ __webpack_require__.d(external_zustand_namespaceObject, {
27
+ create: ()=>create
28
+ });
29
+ const { create: store_create } = external_zustand_namespaceObject;
30
+ const AUTO_ZOOM_KEY = 'midscene-auto-zoom';
31
+ const BACKGROUND_VISIBLE_KEY = 'midscene-background-visible';
32
+ const ELEMENTS_VISIBLE_KEY = 'midscene-elements-visible';
33
+ const parseBooleanParam = (value)=>{
34
+ if (null === value) return;
35
+ const normalized = value.trim().toLowerCase();
36
+ if ([
37
+ '1',
38
+ 'true',
39
+ 'yes',
40
+ 'on'
41
+ ].includes(normalized)) return true;
42
+ if ([
43
+ '0',
44
+ 'false',
45
+ 'no',
46
+ 'off'
47
+ ].includes(normalized)) return false;
48
+ };
49
+ const getQueryPreference = (paramName)=>{
50
+ if ('undefined' == typeof window) return;
51
+ const searchParams = new URLSearchParams(window.location.search);
52
+ return parseBooleanParam(searchParams.get(paramName));
53
+ };
54
+ const useBlackboardPreference = store_create((set)=>{
55
+ const savedAutoZoom = 'false' !== localStorage.getItem(AUTO_ZOOM_KEY);
56
+ const savedBackgroundVisible = 'false' !== localStorage.getItem(BACKGROUND_VISIBLE_KEY);
57
+ const savedElementsVisible = 'false' !== localStorage.getItem(ELEMENTS_VISIBLE_KEY);
58
+ const autoZoomFromQuery = getQueryPreference('focusOnCursor');
59
+ const elementsVisibleFromQuery = getQueryPreference('showElementMarkers');
60
+ return {
61
+ backgroundVisible: savedBackgroundVisible,
62
+ elementsVisible: void 0 === elementsVisibleFromQuery ? savedElementsVisible : elementsVisibleFromQuery,
63
+ autoZoom: void 0 === autoZoomFromQuery ? savedAutoZoom : autoZoomFromQuery,
64
+ setBackgroundVisible: (visible)=>{
65
+ set({
66
+ backgroundVisible: visible
67
+ });
68
+ localStorage.setItem(BACKGROUND_VISIBLE_KEY, visible.toString());
69
+ },
70
+ setElementsVisible: (visible)=>{
71
+ set({
72
+ elementsVisible: visible
73
+ });
74
+ localStorage.setItem(ELEMENTS_VISIBLE_KEY, visible.toString());
75
+ },
76
+ setAutoZoom: (enabled)=>{
77
+ set({
78
+ autoZoom: enabled
79
+ });
80
+ localStorage.setItem(AUTO_ZOOM_KEY, enabled.toString());
81
+ }
82
+ };
83
+ });
84
+ const CONFIG_KEY = 'midscene-env-config';
85
+ const SERVICE_MODE_KEY = 'midscene-service-mode';
86
+ const TRACKING_ACTIVE_TAB_KEY = 'midscene-tracking-active-tab';
87
+ const DEEP_THINK_KEY = 'midscene-deep-think';
88
+ const SCREENSHOT_INCLUDED_KEY = 'midscene-screenshot-included';
89
+ const DOM_INCLUDED_KEY = 'midscene-dom-included';
90
+ const getConfigStringFromLocalStorage = ()=>{
91
+ const configString = localStorage.getItem(CONFIG_KEY);
92
+ return configString || '';
93
+ };
94
+ const parseConfig = (configString)=>{
95
+ const lines = configString.split('\n');
96
+ const config = {};
97
+ lines.forEach((line)=>{
98
+ const trimmed = line.trim();
99
+ if (trimmed.startsWith('#')) return;
100
+ const cleanLine = trimmed.replace(/^export\s+/i, '').replace(/;$/, '').trim();
101
+ const match = cleanLine.match(/^(\w+)=(.*)$/);
102
+ if (match) {
103
+ const [, key, value] = match;
104
+ let parsedValue = value.trim();
105
+ if (parsedValue.startsWith("'") && parsedValue.endsWith("'") || parsedValue.startsWith('"') && parsedValue.endsWith('"')) parsedValue = parsedValue.slice(1, -1);
106
+ config[key] = parsedValue;
107
+ }
108
+ });
109
+ return config;
110
+ };
111
+ const useEnvConfig = store_create((set, get)=>{
112
+ const configString = getConfigStringFromLocalStorage();
113
+ const config = parseConfig(configString);
114
+ const ifInExtension = window.location.href.startsWith('chrome-extension');
115
+ const savedServiceMode = localStorage.getItem(SERVICE_MODE_KEY);
116
+ const savedForceSameTabNavigation = 'false' !== localStorage.getItem(TRACKING_ACTIVE_TAB_KEY);
117
+ const savedDeepThink = 'true' === localStorage.getItem(DEEP_THINK_KEY);
118
+ const savedScreenshotIncluded = 'false' !== localStorage.getItem(SCREENSHOT_INCLUDED_KEY);
119
+ const savedDomIncluded = localStorage.getItem(DOM_INCLUDED_KEY) || 'false';
120
+ return {
121
+ serviceMode: ifInExtension ? 'In-Browser-Extension' : savedServiceMode || 'Server',
122
+ setServiceMode: (serviceMode)=>{
123
+ if (ifInExtension) throw new Error('serviceMode cannot be set in extension');
124
+ set({
125
+ serviceMode
126
+ });
127
+ localStorage.setItem(SERVICE_MODE_KEY, serviceMode);
128
+ },
129
+ config,
130
+ configString,
131
+ setConfig: (config)=>set({
132
+ config
133
+ }),
134
+ loadConfig: (configString)=>{
135
+ const config = parseConfig(configString);
136
+ set({
137
+ config,
138
+ configString
139
+ });
140
+ localStorage.setItem(CONFIG_KEY, configString);
141
+ },
142
+ syncFromStorage: ()=>{
143
+ const latestConfigString = getConfigStringFromLocalStorage();
144
+ const latestConfig = parseConfig(latestConfigString);
145
+ set({
146
+ config: latestConfig,
147
+ configString: latestConfigString
148
+ });
149
+ },
150
+ forceSameTabNavigation: savedForceSameTabNavigation,
151
+ setForceSameTabNavigation: (forceSameTabNavigation)=>{
152
+ set({
153
+ forceSameTabNavigation
154
+ });
155
+ localStorage.setItem(TRACKING_ACTIVE_TAB_KEY, forceSameTabNavigation.toString());
156
+ },
157
+ deepThink: savedDeepThink,
158
+ setDeepThink: (deepThink)=>{
159
+ set({
160
+ deepThink
161
+ });
162
+ localStorage.setItem(DEEP_THINK_KEY, deepThink.toString());
163
+ },
164
+ screenshotIncluded: savedScreenshotIncluded,
165
+ setScreenshotIncluded: (screenshotIncluded)=>{
166
+ set({
167
+ screenshotIncluded
168
+ });
169
+ localStorage.setItem(SCREENSHOT_INCLUDED_KEY, screenshotIncluded.toString());
170
+ },
171
+ domIncluded: 'visible-only' === savedDomIncluded ? 'visible-only' : 'true' === savedDomIncluded,
172
+ setDomIncluded: (domIncluded)=>{
173
+ set({
174
+ domIncluded
175
+ });
176
+ localStorage.setItem(DOM_INCLUDED_KEY, domIncluded.toString());
177
+ },
178
+ popupTab: 'playground',
179
+ setPopupTab: (tab)=>{
180
+ set({
181
+ popupTab: tab
182
+ });
183
+ }
184
+ };
185
+ });
186
+ export { useBlackboardPreference, useEnvConfig };
@@ -0,0 +1,70 @@
1
+ const VALIDATION_CONSTANTS = {
2
+ ZOD_TYPES: {
3
+ OPTIONAL: 'ZodOptional',
4
+ DEFAULT: 'ZodDefault',
5
+ NULLABLE: 'ZodNullable',
6
+ OBJECT: 'ZodObject',
7
+ ENUM: 'ZodEnum',
8
+ NUMBER: 'ZodNumber',
9
+ STRING: 'ZodString',
10
+ BOOLEAN: 'ZodBoolean'
11
+ },
12
+ FIELD_FLAGS: {
13
+ LOCATION: 'midscene_location_field_flag'
14
+ },
15
+ DEFAULT_VALUES: {
16
+ ACTION_TYPE: 'aiAction',
17
+ TIMEOUT_MS: 15000,
18
+ CHECK_INTERVAL_MS: 3000
19
+ }
20
+ };
21
+ const isZodObjectSchema = (schema)=>'object' == typeof schema && null !== schema && ('shape' in schema || 'ZodObject' === schema.type);
22
+ const isLocateField = (field)=>{
23
+ var _field__def;
24
+ const fieldWithRuntime = field;
25
+ if ((null == (_field__def = field._def) ? void 0 : _field__def.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.OBJECT) {
26
+ var _field__def1;
27
+ let shape;
28
+ if (field._def.shape) shape = 'function' == typeof field._def.shape ? field._def.shape() : field._def.shape;
29
+ if (!shape && fieldWithRuntime.shape) shape = fieldWithRuntime.shape;
30
+ if (shape && VALIDATION_CONSTANTS.FIELD_FLAGS.LOCATION in shape) return true;
31
+ const description = (null == (_field__def1 = field._def) ? void 0 : _field__def1.description) || fieldWithRuntime.description || '';
32
+ if ('string' == typeof description && description.toLowerCase().includes('input field')) return true;
33
+ }
34
+ if ('object' == typeof field && null !== field) {
35
+ var _fieldWithRuntime__def;
36
+ const description = fieldWithRuntime.description || (null == (_fieldWithRuntime__def = fieldWithRuntime._def) ? void 0 : _fieldWithRuntime__def.description) || '';
37
+ if ('string' == typeof description) {
38
+ const desc = description.toLowerCase();
39
+ if (desc.includes('input field') || desc.includes('element') || desc.includes('locate')) return true;
40
+ }
41
+ if ('ZodObject' === fieldWithRuntime.typeName || 'ZodObject' === fieldWithRuntime.type) return 'string' == typeof description && description.toLowerCase().includes('input field');
42
+ }
43
+ return false;
44
+ };
45
+ const unwrapZodType = (field)=>{
46
+ var _actualField__def, _actualField__def1, _actualField__def2;
47
+ let actualField = field;
48
+ let isOptional = false;
49
+ let hasDefault = false;
50
+ while((null == (_actualField__def = actualField._def) ? void 0 : _actualField__def.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.OPTIONAL || (null == (_actualField__def1 = actualField._def) ? void 0 : _actualField__def1.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.DEFAULT || (null == (_actualField__def2 = actualField._def) ? void 0 : _actualField__def2.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.NULLABLE){
51
+ var _actualField__def3, _actualField__def4;
52
+ if ((null == (_actualField__def3 = actualField._def) ? void 0 : _actualField__def3.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.OPTIONAL) isOptional = true;
53
+ if ((null == (_actualField__def4 = actualField._def) ? void 0 : _actualField__def4.typeName) === VALIDATION_CONSTANTS.ZOD_TYPES.DEFAULT) hasDefault = true;
54
+ actualField = actualField._def.innerType || actualField;
55
+ }
56
+ return {
57
+ actualField,
58
+ isOptional,
59
+ hasDefault
60
+ };
61
+ };
62
+ const extractDefaultValue = (field)=>{
63
+ var _currentField__def;
64
+ let currentField = field;
65
+ while(null == (_currentField__def = currentField._def) ? void 0 : _currentField__def.innerType){
66
+ if (currentField._def.typeName === VALIDATION_CONSTANTS.ZOD_TYPES.DEFAULT && currentField._def.defaultValue) return currentField._def.defaultValue();
67
+ currentField = currentField._def.innerType;
68
+ }
69
+ };
70
+ export { VALIDATION_CONSTANTS, extractDefaultValue, isLocateField, isZodObjectSchema, unwrapZodType };
@@ -0,0 +1,35 @@
1
+ const elementColor = [
2
+ '#01204E'
3
+ ];
4
+ const highlightColorForSearchArea = '#028391';
5
+ const highlightColorForElement = '#fd5907';
6
+ function djb2Hash(str) {
7
+ if (!str) str = 'unnamed';
8
+ let hash = 5381;
9
+ for(let i = 0; i < str.length; i++)hash = (hash << 5) + hash + str.charCodeAt(i);
10
+ return hash >>> 0;
11
+ }
12
+ function colorForName(name) {
13
+ const hashNumber = djb2Hash(name);
14
+ return elementColor[hashNumber % elementColor.length];
15
+ }
16
+ function highlightColorForType(type) {
17
+ if ('searchArea' === type) return highlightColorForSearchArea;
18
+ return highlightColorForElement;
19
+ }
20
+ function globalThemeConfig() {
21
+ return {
22
+ token: {
23
+ colorPrimary: '#2B83FF'
24
+ },
25
+ components: {
26
+ Layout: {
27
+ headerHeight: 60,
28
+ headerPadding: '0 30px',
29
+ headerBg: '#FFF',
30
+ bodyBg: '#FFF'
31
+ }
32
+ }
33
+ };
34
+ }
35
+ export { colorForName, globalThemeConfig, highlightColorForType };