@overmap-ai/core 1.0.48-activity-history.0 → 1.0.48-activity-history.2

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 {};
@@ -4225,7 +4225,7 @@ async function performRequest(action, client) {
4225
4225
  const errorResponse = extractResponseFromError(error2);
4226
4226
  const status = errorResponse == null ? void 0 : errorResponse.status;
4227
4227
  if (status === 401) {
4228
- if (url.endsWith("auth/token/refresh/")) {
4228
+ if (url.endsWith("/token/refresh/")) {
4229
4229
  if (state.authReducer.isLoggedIn) {
4230
4230
  console.warn("No signed-in user to sign out.");
4231
4231
  }
@@ -5065,6 +5065,10 @@ class AuthService extends BaseApiService {
5065
5065
  checkAuth: false,
5066
5066
  // Don't wait for other requests to finish, or we might end up in a deadlock.
5067
5067
  immediate: true
5068
+ }).catch((e) => {
5069
+ console.error("Could not renew tokens; logging out due to error:", e);
5070
+ void this.logout();
5071
+ return void 0;
5068
5072
  });
5069
5073
  let response = void 0;
5070
5074
  try {
@@ -5073,7 +5077,7 @@ class AuthService extends BaseApiService {
5073
5077
  await this.logout();
5074
5078
  }
5075
5079
  if (!response)
5076
- throw new Error("No response");
5080
+ return void 0;
5077
5081
  if (!response.access)
5078
5082
  throw new Error("Missing access token");
5079
5083
  if (!response.refresh)
@@ -5145,7 +5149,11 @@ class AuthService extends BaseApiService {
5145
5149
  throw new Error("No refresh token found");
5146
5150
  }
5147
5151
  try {
5148
- const { accessToken, refreshToken } = await this._getRenewedTokens(dyingRefreshToken);
5152
+ const tokens = await this._getRenewedTokens(dyingRefreshToken);
5153
+ if (!tokens) {
5154
+ return void 0;
5155
+ }
5156
+ const { accessToken, refreshToken } = tokens;
5149
5157
  console.log("Got renewed tokens");
5150
5158
  store.dispatch(setTokens({ accessToken, refreshToken }));
5151
5159
  } catch (e) {
@@ -7647,10 +7655,33 @@ class DocumentService extends BaseApiService {
7647
7655
  store.dispatch(setDocuments(result));
7648
7656
  }
7649
7657
  }
7658
+ class AgentService extends BaseApiService {
7659
+ /**
7660
+ * Prompt the agent with a message.
7661
+ * @param request The message to prompt the agent with.
7662
+ * @param conversationId If continuing an existing message, the UUID of that conversation.
7663
+ */
7664
+ prompt(request2, conversationId) {
7665
+ const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
7666
+ return this.enqueueRequest({
7667
+ description: "Prompt agent",
7668
+ method: HttpMethod.POST,
7669
+ url: "/agents/prompt/",
7670
+ payload: {
7671
+ prompt: request2,
7672
+ active_project: activeProjectId
7673
+ },
7674
+ blockers: ["prompt"],
7675
+ blocks: ["prompt"],
7676
+ queryParams: conversationId ? { conversation_id: conversationId } : {}
7677
+ });
7678
+ }
7679
+ }
7650
7680
  class OvermapSDK {
7651
7681
  constructor(apiUrl, store) {
7652
7682
  __publicField(this, "API_URL");
7653
7683
  __publicField(this, "store");
7684
+ __publicField(this, "agent", new AgentService(this));
7654
7685
  __publicField(this, "files", new FileService(this));
7655
7686
  __publicField(this, "attachments", new AttachmentService(this));
7656
7687
  __publicField(this, "auth", new AuthService(this));
@@ -15340,6 +15371,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
15340
15371
  }, Symbol.toStringTag, { value: "Module" }));
15341
15372
  export {
15342
15373
  APIError,
15374
+ AgentService,
15343
15375
  AttachmentService,
15344
15376
  AuthService,
15345
15377
  BaseApiService,