@overmap-ai/core 1.0.48-fix-agent-errors.4 → 1.0.48-menu-improvements.1

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @overmap-ai/core
2
-
3
- The `core` package contains core functionality for the Overmap platform. It is a peer dependency of all other overmap
4
- packages.
1
+ # @overmap-ai/core
2
+
3
+ The `core` package contains core functionality for the Overmap platform. It is a peer dependency of all other overmap
4
+ packages.
@@ -6,4 +6,4 @@ export interface ImageCardProps extends Omit<OvermapItemProps, "children" | "lef
6
6
  error?: string;
7
7
  truncateLength?: number;
8
8
  }
9
- export declare const ImageCard: import("react").MemoExoticComponent<(props: ImageCardProps) => import("react/jsx-runtime").JSX.Element>;
9
+ export declare const ImageCard: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<ImageCardProps & import("react").RefAttributes<HTMLDivElement>>>;
@@ -1,6 +1,3 @@
1
1
  import { FieldTypeIdentifier } from "../typings";
2
- export declare const useFieldTypeItems: (onSelect?: (type: Exclude<FieldTypeIdentifier, "section">) => void) => {
3
- content: import("react/jsx-runtime").JSX.Element;
4
- value: "string" | "number" | "boolean" | "select" | "text" | "date" | "multi-string" | "multi-select" | "upload";
5
- onSelect: () => void;
6
- }[][];
2
+ import { MenuItemProps } from "@overmap-ai/blocks";
3
+ export declare const useFieldTypeItems: (onSelect?: (type: Exclude<FieldTypeIdentifier, "section">) => void) => MenuItemProps[][];
@@ -8,7 +8,7 @@ var _a;
8
8
  import * as React from "react";
9
9
  import React__default, { useState, useEffect, useRef, memo, useMemo, useCallback, createContext, createElement, useContext, forwardRef, Children, isValidElement, cloneElement, Fragment as Fragment$1, useLayoutEffect, useReducer, lazy, Suspense } from "react";
10
10
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
11
- import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex as Flex$1, IconButton, RiIcon, Text as Text$1, useSeverityColor, Checkbox, TextArea, Select, useToast, Badge, MultiSelect, useViewportSize, Overlay, ButtonGroup, Spinner, IconColorUtility, Tooltip, Popover, useSize, ToggleButton, Separator, OvermapItem, Button, ButtonList, divButtonProps, DropdownItemMenu, Input, useAlertDialog } from "@overmap-ai/blocks";
11
+ import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex as Flex$1, IconButton, RiIcon, Text as Text$1, useSeverityColor, Checkbox, TextArea, Select, useToast, Badge, MultiSelect, useViewportSize, Overlay, ButtonGroup, Spinner, IconColorUtility, Tooltip, Popover, useSize, ToggleButton, Separator, OvermapItem, Button, ButtonList, divButtonProps, OvermapDropdownMenu, Input, useAlertDialog } from "@overmap-ai/blocks";
12
12
  import { DepGraph } from "dependency-graph";
13
13
  import { offline as offline$1 } from "@redux-offline/redux-offline";
14
14
  import offlineConfig from "@redux-offline/redux-offline/lib/defaults";
@@ -4251,10 +4251,20 @@ function runMiddleware(action) {
4251
4251
  var _a2;
4252
4252
  return (_a2 = allMiddleware[0]) == null ? void 0 : _a2.run(action);
4253
4253
  }
4254
- const discardStatuses = [400, 409, 403, 404];
4254
+ const discardStatuses = [400, 409, 403, 404, 405, 500];
4255
4255
  const statusMessages = {
4256
4256
  403: { title: "Forbidden", description: "You are not authorized to perform this action.", severity: "danger" },
4257
- 404: { title: "Not found", description: "The requested resource was not found.", severity: "danger" }
4257
+ 404: { title: "Not found", description: "The requested resource was not found.", severity: "danger" },
4258
+ 405: {
4259
+ title: "Not supported",
4260
+ description: "It's not you. It's us. Sorry for the inconvenience.",
4261
+ severity: "danger"
4262
+ },
4263
+ 500: {
4264
+ title: "Server error",
4265
+ description: "Our server seems to be experiencing problems at the moment. We have been alerted and will fix the problem as soon as possible.",
4266
+ severity: "danger"
4267
+ }
4258
4268
  };
4259
4269
  function discard(reason, action, retries = 0) {
4260
4270
  var _a2;
@@ -7499,7 +7509,7 @@ class AgentService extends BaseApiService {
7499
7509
  * @param request The message to prompt the agent with.
7500
7510
  * @param conversationId If continuing an existing message, the UUID of that conversation.
7501
7511
  */
7502
- prompt(request2, conversationId) {
7512
+ async prompt(request2, conversationId) {
7503
7513
  const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
7504
7514
  return this.enqueueRequest({
7505
7515
  description: "Prompt agent",
@@ -7514,6 +7524,16 @@ class AgentService extends BaseApiService {
7514
7524
  queryParams: conversationId ? { conversation_id: conversationId } : {}
7515
7525
  });
7516
7526
  }
7527
+ async rate(responseId, rating) {
7528
+ return this.enqueueRequest({
7529
+ description: "Rate agent response",
7530
+ method: HttpMethod.PUT,
7531
+ url: `/agents/responses/${responseId}/rate/`,
7532
+ payload: { rating },
7533
+ blockers: ["rate"],
7534
+ blocks: ["rate"]
7535
+ });
7536
+ }
7517
7537
  }
7518
7538
  class OvermapSDK {
7519
7539
  constructor(apiUrl, store) {
@@ -13002,52 +13022,54 @@ const styles$4 = {
13002
13022
  Footer,
13003
13023
  Loading
13004
13024
  };
13005
- const ImageCard = memo((props) => {
13006
- const { file, alt, error: error2, size, rightSlot, className, truncateLength, ...rest } = props;
13007
- const fileCardRef = useRef(null);
13008
- const imageInsetRef = useRef(null);
13009
- const fileCardSize = useSize(fileCardRef);
13010
- useLayoutEffect(() => {
13011
- if (!imageInsetRef.current || !fileCardSize)
13012
- return;
13013
- imageInsetRef.current.style.height = `${fileCardSize.height * 4}px`;
13014
- }, [fileCardSize]);
13015
- const fileName2 = useMemo(() => {
13016
- if (!file)
13017
- return;
13018
- return truncateLength !== void 0 ? truncate(file.name, truncateLength) : file.name;
13019
- }, [file, truncateLength]);
13020
- return /* @__PURE__ */ jsxs(
13021
- Flex,
13022
- {
13023
- className: classNames$1(className, styles$4.ImageCard),
13024
- width: "100%",
13025
- direction: "column",
13026
- position: "relative",
13027
- height: "max-content",
13028
- gap: "0",
13029
- ...rest,
13030
- children: [
13031
- !file && !error2 && /* @__PURE__ */ jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsx(Spinner, {}) }),
13032
- /* @__PURE__ */ jsx(Inset, { className: styles$4.ImageInset, ref: imageInsetRef, clip: "padding-box", side: "y", pb: "0", children: file && !error2 && /* @__PURE__ */ jsx("img", { className: styles$4.Image, src: URL.createObjectURL(file), alt: alt ?? file.name }) }),
13033
- /* @__PURE__ */ jsx(
13034
- OvermapItem,
13035
- {
13036
- className: classNames$1(styles$4.Footer, {
13037
- [styles$4.Loading]: !file
13038
- }),
13039
- size,
13040
- ref: fileCardRef,
13041
- leftSlot: error2 ? /* @__PURE__ */ jsx(RiIcon, { icon: "RiFileWarningLine" }) : file && /* @__PURE__ */ jsx(FileIcon, { fileType: file.type }),
13042
- rightSlot,
13043
- children: error2 ?? fileName2
13044
- }
13045
- )
13046
- ]
13047
- }
13048
- );
13049
- });
13050
- ImageCard.displayName = "ImageCard";
13025
+ const ImageCard = memo(
13026
+ forwardRef((props, forwardedRef) => {
13027
+ const { file, alt, error: error2, size, rightSlot, className, truncateLength, ...rest } = props;
13028
+ const fileCardRef = useRef(null);
13029
+ const imageInsetRef = useRef(null);
13030
+ const fileCardSize = useSize(fileCardRef);
13031
+ useLayoutEffect(() => {
13032
+ if (!imageInsetRef.current || !fileCardSize)
13033
+ return;
13034
+ imageInsetRef.current.style.height = `${fileCardSize.height * 4}px`;
13035
+ }, [fileCardSize]);
13036
+ const fileName2 = useMemo(() => {
13037
+ if (!file)
13038
+ return;
13039
+ return truncateLength !== void 0 ? truncate(file.name, truncateLength) : file.name;
13040
+ }, [file, truncateLength]);
13041
+ return /* @__PURE__ */ jsxs(
13042
+ Flex,
13043
+ {
13044
+ className: classNames$1(className, styles$4.ImageCard),
13045
+ width: "100%",
13046
+ direction: "column",
13047
+ position: "relative",
13048
+ height: "max-content",
13049
+ gap: "0",
13050
+ ref: forwardedRef,
13051
+ ...rest,
13052
+ children: [
13053
+ !file && !error2 && /* @__PURE__ */ jsx(Flex, { width: "100%", height: "100%", align: "center", justify: "center", position: "absolute", children: /* @__PURE__ */ jsx(Spinner, {}) }),
13054
+ /* @__PURE__ */ jsx(Inset, { className: styles$4.ImageInset, ref: imageInsetRef, clip: "padding-box", side: "y", pb: "0", children: file && !error2 && /* @__PURE__ */ jsx("img", { className: styles$4.Image, src: URL.createObjectURL(file), alt: alt ?? file.name }) }),
13055
+ /* @__PURE__ */ jsx(
13056
+ OvermapItem,
13057
+ {
13058
+ className: classNames$1(styles$4.Footer, {
13059
+ [styles$4.Loading]: !file
13060
+ }),
13061
+ size,
13062
+ ref: fileCardRef,
13063
+ leftSlot: error2 ? /* @__PURE__ */ jsx(RiIcon, { icon: "RiFileWarningLine" }) : file && /* @__PURE__ */ jsx(FileIcon, { fileType: file.type }),
13064
+ rightSlot,
13065
+ children: error2 ?? fileName2
13066
+ }
13067
+ )
13068
+ ]
13069
+ }
13070
+ );
13071
+ })
13072
+ );
13051
13073
  const UploadInput = memo((props) => {
13052
13074
  var _a2;
13053
13075
  const [{ inputId, labelId, size, severity, helpText, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
@@ -14184,17 +14206,15 @@ const FieldActions = memo((props) => {
14184
14206
  Action.key
14185
14207
  )) }),
14186
14208
  /* @__PURE__ */ jsx(Box, { display: forMobile(true, "block"), children: /* @__PURE__ */ jsx(
14187
- DropdownItemMenu,
14209
+ OvermapDropdownMenu,
14188
14210
  {
14189
14211
  trigger: /* @__PURE__ */ jsx(IconButton, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiMore2Line" }) }),
14190
14212
  items: actions.map((Action) => {
14191
14213
  var _a2;
14192
14214
  return {
14193
- content: /* @__PURE__ */ jsxs(Flex$1, { gap: "2", align: "center", children: [
14194
- /* @__PURE__ */ jsx(Action.Icon, {}),
14195
- Action.text
14196
- ] }, Action.key),
14197
- onSelect: (_a2 = Action.buttonProps) == null ? void 0 : _a2.onClick
14215
+ leftSlot: /* @__PURE__ */ jsx(Action.Icon, {}),
14216
+ children: Action.text,
14217
+ onClick: (_a2 = Action.buttonProps) == null ? void 0 : _a2.onClick
14198
14218
  };
14199
14219
  })
14200
14220
  }
@@ -14252,10 +14272,8 @@ const useFieldTypeItems = (onSelect = () => null) => {
14252
14272
  const field = FieldTypeToClsMapping[identifier];
14253
14273
  const Icon = field.Icon;
14254
14274
  return {
14255
- content: /* @__PURE__ */ jsxs(Flex$1, { align: "center", gap: "2", children: [
14256
- /* @__PURE__ */ jsx(Icon, {}),
14257
- /* @__PURE__ */ jsx(Text$1, { children: field.fieldTypeName })
14258
- ] }, identifier),
14275
+ children: field.fieldTypeName,
14276
+ leftSlot: /* @__PURE__ */ jsx(Icon, {}),
14259
14277
  value: identifier,
14260
14278
  onSelect: () => {
14261
14279
  onSelect(identifier);
@@ -14820,7 +14838,7 @@ const FieldSectionWithActions = memo((props) => {
14820
14838
  )),
14821
14839
  droppableProvided.placeholder,
14822
14840
  /* @__PURE__ */ jsx(
14823
- DropdownItemMenu,
14841
+ OvermapDropdownMenu,
14824
14842
  {
14825
14843
  trigger: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "soft", children: [
14826
14844
  /* @__PURE__ */ jsx(RiIcon, { icon: "RiAddLine" }),