@overmap-ai/core 1.0.48-add-agent-service.2 → 1.0.48-add-agent-response-rating.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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { FileViewerConfig } from "./typings.ts";
2
+ import { FileViewerConfig } from "./typings";
3
3
  export type FileViewerContextType = (func: (close: () => void) => FileViewerConfig) => void;
4
4
  export declare const FileViewerContext: import("react").Context<FileViewerContextType>;
5
5
  export declare const useFileViewer: () => FileViewerContextType;
@@ -1,5 +1,5 @@
1
1
  import { ChangeEvent } from "react";
2
- import { FieldTypeIdentifier } from "../typings.ts";
2
+ import { FieldTypeIdentifier } from "../typings";
3
3
  interface FieldActionsProps {
4
4
  index: number;
5
5
  type: FieldTypeIdentifier;
@@ -0,0 +1,2 @@
1
+ export declare const SHORT_TEXT_FIELD_MAX_LENGTH = 500;
2
+ export declare const LONG_TEXT_FIELD_MAX_LENGTH = 10000;
@@ -0,0 +1,9 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ interface FullScreenImagePreviewProps {
3
+ file: File;
4
+ url: string;
5
+ name: string;
6
+ setShowPreview: Dispatch<SetStateAction<boolean>>;
7
+ }
8
+ export declare const FullScreenImagePreview: import("react").MemoExoticComponent<(props: FullScreenImagePreviewProps) => import("react/jsx-runtime").JSX.Element>;
9
+ export {};
@@ -4170,7 +4170,7 @@ async function performRequest(action, client) {
4170
4170
  const errorResponse = extractResponseFromError(error2);
4171
4171
  const status = errorResponse == null ? void 0 : errorResponse.status;
4172
4172
  if (status === 401) {
4173
- if (url.endsWith("auth/token/refresh/")) {
4173
+ if (url.endsWith("/token/refresh/")) {
4174
4174
  if (state.authReducer.isLoggedIn) {
4175
4175
  console.warn("No signed-in user to sign out.");
4176
4176
  }
@@ -4251,7 +4251,7 @@ 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
4257
  404: { title: "Not found", description: "The requested resource was not found.", severity: "danger" }
@@ -5010,6 +5010,10 @@ class AuthService extends BaseApiService {
5010
5010
  checkAuth: false,
5011
5011
  // Don't wait for other requests to finish, or we might end up in a deadlock.
5012
5012
  immediate: true
5013
+ }).catch((e) => {
5014
+ console.error("Could not renew tokens; logging out due to error:", e);
5015
+ void this.logout();
5016
+ return void 0;
5013
5017
  });
5014
5018
  let response = void 0;
5015
5019
  try {
@@ -5018,7 +5022,7 @@ class AuthService extends BaseApiService {
5018
5022
  await this.logout();
5019
5023
  }
5020
5024
  if (!response)
5021
- throw new Error("No response");
5025
+ return void 0;
5022
5026
  if (!response.access)
5023
5027
  throw new Error("Missing access token");
5024
5028
  if (!response.refresh)
@@ -5090,7 +5094,11 @@ class AuthService extends BaseApiService {
5090
5094
  throw new Error("No refresh token found");
5091
5095
  }
5092
5096
  try {
5093
- const { accessToken, refreshToken } = await this._getRenewedTokens(dyingRefreshToken);
5097
+ const tokens = await this._getRenewedTokens(dyingRefreshToken);
5098
+ if (!tokens) {
5099
+ return void 0;
5100
+ }
5101
+ const { accessToken, refreshToken } = tokens;
5094
5102
  console.log("Got renewed tokens");
5095
5103
  store.dispatch(setTokens({ accessToken, refreshToken }));
5096
5104
  } catch (e) {
@@ -6105,7 +6113,6 @@ class ProjectAccessService extends BaseApiService {
6105
6113
  async remove(projectAccess) {
6106
6114
  const { store } = this.client;
6107
6115
  store.dispatch(removeProjectAccess(projectAccess));
6108
- store.dispatch(removeUser(projectAccess.user));
6109
6116
  return this.enqueueRequest({
6110
6117
  description: "Delete project access",
6111
6118
  method: HttpMethod.DELETE,
@@ -7487,18 +7494,34 @@ class DocumentService extends BaseApiService {
7487
7494
  }
7488
7495
  }
7489
7496
  class AgentService extends BaseApiService {
7490
- prompt(request2) {
7497
+ /**
7498
+ * Prompt the agent with a message.
7499
+ * @param request The message to prompt the agent with.
7500
+ * @param conversationId If continuing an existing message, the UUID of that conversation.
7501
+ */
7502
+ async prompt(request2, conversationId) {
7491
7503
  const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
7492
7504
  return this.enqueueRequest({
7493
7505
  description: "Prompt agent",
7494
- method: HttpMethod.POST,
7506
+ method: HttpMethod.PUT,
7495
7507
  url: "/agents/prompt/",
7496
7508
  payload: {
7497
7509
  prompt: request2,
7498
7510
  active_project: activeProjectId
7499
7511
  },
7500
7512
  blockers: ["prompt"],
7501
- blocks: ["prompt"]
7513
+ blocks: ["prompt"],
7514
+ queryParams: conversationId ? { conversation_id: conversationId } : {}
7515
+ });
7516
+ }
7517
+ async rate(responseId, rating) {
7518
+ return this.enqueueRequest({
7519
+ description: "Rate agent response",
7520
+ method: HttpMethod.POST,
7521
+ url: `/agents/responses/${responseId}/rate/`,
7522
+ payload: { rating },
7523
+ blockers: ["rate"],
7524
+ blocks: ["rate"]
7502
7525
  });
7503
7526
  }
7504
7527
  }