@vectorize-io/hindsight-client 0.4.21 → 0.5.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/dist/index.js CHANGED
@@ -24,6 +24,7 @@ __export(index_exports, {
24
24
  HindsightError: () => HindsightError,
25
25
  createClient: () => createClient,
26
26
  createConfig: () => createConfig,
27
+ recallResponseToPromptString: () => recallResponseToPromptString,
27
28
  sdk: () => sdk_gen_exports
28
29
  });
29
30
  module.exports = __toCommonJS(index_exports);
@@ -895,10 +896,12 @@ __export(sdk_gen_exports, {
895
896
  deleteDocument: () => deleteDocument,
896
897
  deleteMentalModel: () => deleteMentalModel,
897
898
  deleteWebhook: () => deleteWebhook,
899
+ exportBankTemplate: () => exportBankTemplate,
898
900
  fileRetain: () => fileRetain,
899
901
  getAgentStats: () => getAgentStats,
900
902
  getBankConfig: () => getBankConfig,
901
903
  getBankProfile: () => getBankProfile,
904
+ getBankTemplateSchema: () => getBankTemplateSchema,
902
905
  getChunk: () => getChunk,
903
906
  getDirective: () => getDirective,
904
907
  getDocument: () => getDocument,
@@ -911,6 +914,7 @@ __export(sdk_gen_exports, {
911
914
  getOperationStatus: () => getOperationStatus,
912
915
  getVersion: () => getVersion,
913
916
  healthEndpointHealthGet: () => healthEndpointHealthGet,
917
+ importBankTemplate: () => importBankTemplate,
914
918
  listAuditLogs: () => listAuditLogs,
915
919
  listBanks: () => listBanks,
916
920
  listDirectives: () => listDirectives,
@@ -1100,6 +1104,9 @@ var createOrUpdateBank = (options) => (options.client ?? client).put({
1100
1104
  ...options.headers
1101
1105
  }
1102
1106
  });
1107
+ var importBankTemplate = (options) => (options.client ?? client).post({ url: "/v1/default/banks/{bank_id}/import", ...options });
1108
+ var exportBankTemplate = (options) => (options.client ?? client).get({ url: "/v1/default/banks/{bank_id}/export", ...options });
1109
+ var getBankTemplateSchema = (options) => (options?.client ?? client).get({ url: "/v1/bank-template-schema", ...options });
1103
1110
  var clearObservations = (options) => (options.client ?? client).delete({ url: "/v1/default/banks/{bank_id}/observations", ...options });
1104
1111
  var recoverConsolidation = (options) => (options.client ?? client).post({ url: "/v1/default/banks/{bank_id}/consolidation/recover", ...options });
1105
1112
  var clearMemoryObservations = (options) => (options.client ?? client).delete({
@@ -1218,6 +1225,9 @@ var HindsightClient = class {
1218
1225
  if (options?.tags) {
1219
1226
  item.tags = options.tags;
1220
1227
  }
1228
+ if (options?.updateMode) {
1229
+ item.update_mode = options.updateMode;
1230
+ }
1221
1231
  const response = await retainMemories({
1222
1232
  client: this.client,
1223
1233
  path: { bank_id: bankId },
@@ -1238,6 +1248,7 @@ var HindsightClient = class {
1238
1248
  tags: item.tags,
1239
1249
  observation_scopes: item.observation_scopes,
1240
1250
  strategy: item.strategy,
1251
+ update_mode: item.update_mode,
1241
1252
  timestamp: item.timestamp instanceof Date ? item.timestamp.toISOString() : item.timestamp
1242
1253
  }));
1243
1254
  const itemsWithDocId = processedItems.map((item) => ({
@@ -1601,12 +1612,43 @@ var HindsightClient = class {
1601
1612
  return this.validateResponse(response, "getMentalModelHistory");
1602
1613
  }
1603
1614
  };
1615
+ function recallResponseToPromptString(response) {
1616
+ const chunksMap = response.chunks ?? {};
1617
+ const sections = [];
1618
+ const formattedFacts = (response.results ?? []).map((result) => {
1619
+ const obj = { text: result.text };
1620
+ if (result.context) obj.context = result.context;
1621
+ if (result.occurred_start) obj.occurred_start = result.occurred_start;
1622
+ if (result.occurred_end) obj.occurred_end = result.occurred_end;
1623
+ if (result.mentioned_at) obj.mentioned_at = result.mentioned_at;
1624
+ if (result.chunk_id && chunksMap[result.chunk_id]) {
1625
+ obj.source_chunk = chunksMap[result.chunk_id].text;
1626
+ }
1627
+ return obj;
1628
+ });
1629
+ sections.push("FACTS:\n" + JSON.stringify(formattedFacts, null, 2));
1630
+ const entities = response.entities;
1631
+ if (entities) {
1632
+ const entityParts = [];
1633
+ for (const [name, state] of Object.entries(entities)) {
1634
+ if (state.observations?.length) {
1635
+ entityParts.push(`## ${name}
1636
+ ${state.observations[0].text}`);
1637
+ }
1638
+ }
1639
+ if (entityParts.length) {
1640
+ sections.push("ENTITIES:\n" + entityParts.join("\n\n"));
1641
+ }
1642
+ }
1643
+ return sections.join("\n\n");
1644
+ }
1604
1645
  // Annotate the CommonJS export names for ESM import in node:
1605
1646
  0 && (module.exports = {
1606
1647
  HindsightClient,
1607
1648
  HindsightError,
1608
1649
  createClient,
1609
1650
  createConfig,
1651
+ recallResponseToPromptString,
1610
1652
  sdk
1611
1653
  });
1612
1654
  //# sourceMappingURL=index.js.map