@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.
@@ -4216,7 +4216,7 @@ var __publicField = (obj, key, value) => {
4216
4216
  const errorResponse = extractResponseFromError(error2);
4217
4217
  const status = errorResponse == null ? void 0 : errorResponse.status;
4218
4218
  if (status === 401) {
4219
- if (url.endsWith("auth/token/refresh/")) {
4219
+ if (url.endsWith("/token/refresh/")) {
4220
4220
  if (state.authReducer.isLoggedIn) {
4221
4221
  console.warn("No signed-in user to sign out.");
4222
4222
  }
@@ -5056,6 +5056,10 @@ var __publicField = (obj, key, value) => {
5056
5056
  checkAuth: false,
5057
5057
  // Don't wait for other requests to finish, or we might end up in a deadlock.
5058
5058
  immediate: true
5059
+ }).catch((e) => {
5060
+ console.error("Could not renew tokens; logging out due to error:", e);
5061
+ void this.logout();
5062
+ return void 0;
5059
5063
  });
5060
5064
  let response = void 0;
5061
5065
  try {
@@ -5064,7 +5068,7 @@ var __publicField = (obj, key, value) => {
5064
5068
  await this.logout();
5065
5069
  }
5066
5070
  if (!response)
5067
- throw new Error("No response");
5071
+ return void 0;
5068
5072
  if (!response.access)
5069
5073
  throw new Error("Missing access token");
5070
5074
  if (!response.refresh)
@@ -5136,7 +5140,11 @@ var __publicField = (obj, key, value) => {
5136
5140
  throw new Error("No refresh token found");
5137
5141
  }
5138
5142
  try {
5139
- const { accessToken, refreshToken } = await this._getRenewedTokens(dyingRefreshToken);
5143
+ const tokens = await this._getRenewedTokens(dyingRefreshToken);
5144
+ if (!tokens) {
5145
+ return void 0;
5146
+ }
5147
+ const { accessToken, refreshToken } = tokens;
5140
5148
  console.log("Got renewed tokens");
5141
5149
  store.dispatch(setTokens({ accessToken, refreshToken }));
5142
5150
  } catch (e) {
@@ -7638,10 +7646,33 @@ var __publicField = (obj, key, value) => {
7638
7646
  store.dispatch(setDocuments(result));
7639
7647
  }
7640
7648
  }
7649
+ class AgentService extends BaseApiService {
7650
+ /**
7651
+ * Prompt the agent with a message.
7652
+ * @param request The message to prompt the agent with.
7653
+ * @param conversationId If continuing an existing message, the UUID of that conversation.
7654
+ */
7655
+ prompt(request2, conversationId) {
7656
+ const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
7657
+ return this.enqueueRequest({
7658
+ description: "Prompt agent",
7659
+ method: HttpMethod.POST,
7660
+ url: "/agents/prompt/",
7661
+ payload: {
7662
+ prompt: request2,
7663
+ active_project: activeProjectId
7664
+ },
7665
+ blockers: ["prompt"],
7666
+ blocks: ["prompt"],
7667
+ queryParams: conversationId ? { conversation_id: conversationId } : {}
7668
+ });
7669
+ }
7670
+ }
7641
7671
  class OvermapSDK {
7642
7672
  constructor(apiUrl, store) {
7643
7673
  __publicField(this, "API_URL");
7644
7674
  __publicField(this, "store");
7675
+ __publicField(this, "agent", new AgentService(this));
7645
7676
  __publicField(this, "files", new FileService(this));
7646
7677
  __publicField(this, "attachments", new AttachmentService(this));
7647
7678
  __publicField(this, "auth", new AuthService(this));
@@ -15330,6 +15361,7 @@ var __publicField = (obj, key, value) => {
15330
15361
  valueIsFile
15331
15362
  }, Symbol.toStringTag, { value: "Module" }));
15332
15363
  exports2.APIError = APIError;
15364
+ exports2.AgentService = AgentService;
15333
15365
  exports2.AttachmentService = AttachmentService;
15334
15366
  exports2.AuthService = AuthService;
15335
15367
  exports2.BaseApiService = BaseApiService;