@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.
@@ -3531,6 +3531,9 @@ var __publicField = (obj, key, value) => {
3531
3531
  toolkit.createSelector(
3532
3532
  [(state) => state.userFormReducer.revisions, (_state, formId2) => formId2],
3533
3533
  (revisions, formId2) => {
3534
+ if (!formId2) {
3535
+ throw new Error("formId is required");
3536
+ }
3534
3537
  return _selectLatestFormRevision(revisions, formId2);
3535
3538
  }
3536
3539
  )
@@ -4998,6 +5001,10 @@ var __publicField = (obj, key, value) => {
4998
5001
  checkAuth: false,
4999
5002
  // Don't wait for other requests to finish, or we might end up in a deadlock.
5000
5003
  immediate: true
5004
+ }).catch((e) => {
5005
+ console.error("Could not renew tokens; logging out due to error:", e);
5006
+ void this.logout();
5007
+ return void 0;
5001
5008
  });
5002
5009
  let response = void 0;
5003
5010
  try {
@@ -5006,7 +5013,7 @@ var __publicField = (obj, key, value) => {
5006
5013
  await this.logout();
5007
5014
  }
5008
5015
  if (!response)
5009
- throw new Error("No response");
5016
+ return void 0;
5010
5017
  if (!response.access)
5011
5018
  throw new Error("Missing access token");
5012
5019
  if (!response.refresh)
@@ -5078,7 +5085,11 @@ var __publicField = (obj, key, value) => {
5078
5085
  throw new Error("No refresh token found");
5079
5086
  }
5080
5087
  try {
5081
- const { accessToken, refreshToken } = await this._getRenewedTokens(dyingRefreshToken);
5088
+ const tokens = await this._getRenewedTokens(dyingRefreshToken);
5089
+ if (!tokens) {
5090
+ return void 0;
5091
+ }
5092
+ const { accessToken, refreshToken } = tokens;
5082
5093
  console.log("Got renewed tokens");
5083
5094
  store.dispatch(setTokens({ accessToken, refreshToken }));
5084
5095
  } catch (e) {
@@ -7473,10 +7484,33 @@ var __publicField = (obj, key, value) => {
7473
7484
  store.dispatch(setDocuments(result));
7474
7485
  }
7475
7486
  }
7487
+ class AgentService extends BaseApiService {
7488
+ /**
7489
+ * Prompt the agent with a message.
7490
+ * @param request The message to prompt the agent with.
7491
+ * @param conversationId If continuing an existing message, the UUID of that conversation.
7492
+ */
7493
+ prompt(request2, conversationId) {
7494
+ const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
7495
+ return this.enqueueRequest({
7496
+ description: "Prompt agent",
7497
+ method: HttpMethod.POST,
7498
+ url: "/agents/prompt/",
7499
+ payload: {
7500
+ prompt: request2,
7501
+ active_project: activeProjectId
7502
+ },
7503
+ blockers: ["prompt"],
7504
+ blocks: ["prompt"],
7505
+ queryParams: conversationId ? { conversation_id: conversationId } : {}
7506
+ });
7507
+ }
7508
+ }
7476
7509
  class OvermapSDK {
7477
7510
  constructor(apiUrl, store) {
7478
7511
  __publicField(this, "API_URL");
7479
7512
  __publicField(this, "store");
7513
+ __publicField(this, "agent", new AgentService(this));
7480
7514
  __publicField(this, "files", new FileService(this));
7481
7515
  __publicField(this, "attachments", new AttachmentService(this));
7482
7516
  __publicField(this, "auth", new AuthService(this));
@@ -15164,6 +15198,7 @@ var __publicField = (obj, key, value) => {
15164
15198
  valueIsFile
15165
15199
  }, Symbol.toStringTag, { value: "Module" }));
15166
15200
  exports2.APIError = APIError;
15201
+ exports2.AgentService = AgentService;
15167
15202
  exports2.AttachmentService = AttachmentService;
15168
15203
  exports2.AuthService = AuthService;
15169
15204
  exports2.BaseApiService = BaseApiService;