@overmap-ai/core 1.0.48-few-bug-fixes.0 → 1.0.48-fix-agent-errors.0

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.
@@ -3540,6 +3540,9 @@ const selectLatestFormRevision = restructureCreateSelectorWithArgs(
3540
3540
  createSelector(
3541
3541
  [(state) => state.userFormReducer.revisions, (_state, formId2) => formId2],
3542
3542
  (revisions, formId2) => {
3543
+ if (!formId2) {
3544
+ throw new Error("formId is required");
3545
+ }
3543
3546
  return _selectLatestFormRevision(revisions, formId2);
3544
3547
  }
3545
3548
  )
@@ -5007,6 +5010,10 @@ class AuthService extends BaseApiService {
5007
5010
  checkAuth: false,
5008
5011
  // Don't wait for other requests to finish, or we might end up in a deadlock.
5009
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;
5010
5017
  });
5011
5018
  let response = void 0;
5012
5019
  try {
@@ -5015,7 +5022,7 @@ class AuthService extends BaseApiService {
5015
5022
  await this.logout();
5016
5023
  }
5017
5024
  if (!response)
5018
- throw new Error("No response");
5025
+ return void 0;
5019
5026
  if (!response.access)
5020
5027
  throw new Error("Missing access token");
5021
5028
  if (!response.refresh)
@@ -5087,7 +5094,11 @@ class AuthService extends BaseApiService {
5087
5094
  throw new Error("No refresh token found");
5088
5095
  }
5089
5096
  try {
5090
- 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;
5091
5102
  console.log("Got renewed tokens");
5092
5103
  store.dispatch(setTokens({ accessToken, refreshToken }));
5093
5104
  } catch (e) {
@@ -7482,10 +7493,33 @@ class DocumentService extends BaseApiService {
7482
7493
  store.dispatch(setDocuments(result));
7483
7494
  }
7484
7495
  }
7496
+ class AgentService extends BaseApiService {
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
+ prompt(request2, conversationId) {
7503
+ const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
7504
+ return this.enqueueRequest({
7505
+ description: "Prompt agent",
7506
+ method: HttpMethod.POST,
7507
+ url: "/agents/prompt/",
7508
+ payload: {
7509
+ prompt: request2,
7510
+ active_project: activeProjectId
7511
+ },
7512
+ blockers: ["prompt"],
7513
+ blocks: ["prompt"],
7514
+ queryParams: conversationId ? { conversation_id: conversationId } : {}
7515
+ });
7516
+ }
7517
+ }
7485
7518
  class OvermapSDK {
7486
7519
  constructor(apiUrl, store) {
7487
7520
  __publicField(this, "API_URL");
7488
7521
  __publicField(this, "store");
7522
+ __publicField(this, "agent", new AgentService(this));
7489
7523
  __publicField(this, "files", new FileService(this));
7490
7524
  __publicField(this, "attachments", new AttachmentService(this));
7491
7525
  __publicField(this, "auth", new AuthService(this));
@@ -15174,6 +15208,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
15174
15208
  }, Symbol.toStringTag, { value: "Module" }));
15175
15209
  export {
15176
15210
  APIError,
15211
+ AgentService,
15177
15212
  AttachmentService,
15178
15213
  AuthService,
15179
15214
  BaseApiService,