@vectorize-io/hindsight-client 0.4.12 → 0.4.14
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/generated/sdk.gen.d.ts +11 -1
- package/dist/generated/sdk.gen.d.ts.map +1 -1
- package/dist/generated/sdk.gen.js +15 -1
- package/dist/generated/sdk.gen.js.map +1 -1
- package/dist/generated/types.gen.d.ts +157 -3
- package/dist/generated/types.gen.d.ts.map +1 -1
- package/dist/src/index.d.ts +76 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +76 -7
- package/dist/src/index.js.map +1 -1
- package/generated/sdk.gen.ts +24 -0
- package/generated/types.gen.ts +166 -3
- package/package.json +1 -1
- package/src/index.ts +126 -7
package/src/index.ts
CHANGED
|
@@ -39,6 +39,7 @@ import type {
|
|
|
39
39
|
FileRetainResponse,
|
|
40
40
|
ListMemoryUnitsResponse,
|
|
41
41
|
BankProfileResponse,
|
|
42
|
+
BankConfigResponse,
|
|
42
43
|
CreateBankRequest,
|
|
43
44
|
Budget,
|
|
44
45
|
} from '../generated/types.gen';
|
|
@@ -262,6 +263,10 @@ export class HindsightClient {
|
|
|
262
263
|
maxEntityTokens?: number;
|
|
263
264
|
includeChunks?: boolean;
|
|
264
265
|
maxChunkTokens?: number;
|
|
266
|
+
/** Include source facts for observation-type results */
|
|
267
|
+
includeSourceFacts?: boolean;
|
|
268
|
+
/** Maximum tokens for source facts (default: 4096) */
|
|
269
|
+
maxSourceFactsTokens?: number;
|
|
265
270
|
/** Optional list of tags to filter memories by */
|
|
266
271
|
tags?: string[];
|
|
267
272
|
/** How to match tags: 'any' (OR, includes untagged), 'all' (AND, includes untagged), 'any_strict' (OR, excludes untagged), 'all_strict' (AND, excludes untagged). Default: 'any' */
|
|
@@ -281,6 +286,7 @@ export class HindsightClient {
|
|
|
281
286
|
include: {
|
|
282
287
|
entities: options?.includeEntities ? { max_tokens: options?.maxEntityTokens ?? 500 } : undefined,
|
|
283
288
|
chunks: options?.includeChunks ? { max_tokens: options?.maxChunkTokens ?? 8192 } : undefined,
|
|
289
|
+
source_facts: options?.includeSourceFacts ? { max_tokens: options?.maxSourceFactsTokens ?? 4096 } : undefined,
|
|
284
290
|
},
|
|
285
291
|
tags: options?.tags,
|
|
286
292
|
tags_match: options?.tagsMatch,
|
|
@@ -342,25 +348,73 @@ export class HindsightClient {
|
|
|
342
348
|
}
|
|
343
349
|
|
|
344
350
|
/**
|
|
345
|
-
* Create or update a bank with disposition and
|
|
351
|
+
* Create or update a bank with disposition, missions, and operational configuration.
|
|
346
352
|
*/
|
|
347
353
|
async createBank(
|
|
348
354
|
bankId: string,
|
|
349
|
-
options: {
|
|
355
|
+
options: {
|
|
356
|
+
/** @deprecated Display label only. */
|
|
357
|
+
name?: string;
|
|
358
|
+
/** @deprecated Use reflectMission instead. */
|
|
359
|
+
mission?: string;
|
|
360
|
+
/** Mission/context for Reflect operations. */
|
|
361
|
+
reflectMission?: string;
|
|
362
|
+
/** @deprecated Alias for mission. */
|
|
363
|
+
background?: string;
|
|
364
|
+
/** @deprecated Use dispositionSkepticism, dispositionLiteralism, dispositionEmpathy instead. */
|
|
365
|
+
disposition?: { skepticism: number; literalism: number; empathy: number };
|
|
366
|
+
/** @deprecated Use updateBankConfig({ dispositionSkepticism }) instead. */
|
|
367
|
+
dispositionSkepticism?: number;
|
|
368
|
+
/** @deprecated Use updateBankConfig({ dispositionLiteralism }) instead. */
|
|
369
|
+
dispositionLiteralism?: number;
|
|
370
|
+
/** @deprecated Use updateBankConfig({ dispositionEmpathy }) instead. */
|
|
371
|
+
dispositionEmpathy?: number;
|
|
372
|
+
/** Steers what gets extracted during retain(). Injected alongside built-in rules. */
|
|
373
|
+
retainMission?: string;
|
|
374
|
+
/** Fact extraction mode: 'concise' (default), 'verbose', or 'custom'. */
|
|
375
|
+
retainExtractionMode?: string;
|
|
376
|
+
/** Custom extraction prompt (only active when retainExtractionMode is 'custom'). */
|
|
377
|
+
retainCustomInstructions?: string;
|
|
378
|
+
/** Maximum token size for each content chunk during retain. */
|
|
379
|
+
retainChunkSize?: number;
|
|
380
|
+
/** Toggle automatic observation consolidation after retain(). */
|
|
381
|
+
enableObservations?: boolean;
|
|
382
|
+
/** Controls what gets synthesised into observations. Replaces built-in rules. */
|
|
383
|
+
observationsMission?: string;
|
|
384
|
+
} = {}
|
|
350
385
|
): Promise<BankProfileResponse> {
|
|
351
386
|
const response = await sdk.createOrUpdateBank({
|
|
352
387
|
client: this.client,
|
|
353
388
|
path: { bank_id: bankId },
|
|
354
389
|
body: {
|
|
355
390
|
name: options.name,
|
|
391
|
+
mission: options.mission,
|
|
392
|
+
reflect_mission: options.reflectMission,
|
|
356
393
|
background: options.background,
|
|
357
394
|
disposition: options.disposition,
|
|
395
|
+
disposition_skepticism: options.dispositionSkepticism,
|
|
396
|
+
disposition_literalism: options.dispositionLiteralism,
|
|
397
|
+
disposition_empathy: options.dispositionEmpathy,
|
|
398
|
+
retain_mission: options.retainMission,
|
|
399
|
+
retain_extraction_mode: options.retainExtractionMode,
|
|
400
|
+
retain_custom_instructions: options.retainCustomInstructions,
|
|
401
|
+
retain_chunk_size: options.retainChunkSize,
|
|
402
|
+
enable_observations: options.enableObservations,
|
|
403
|
+
observations_mission: options.observationsMission,
|
|
358
404
|
},
|
|
359
405
|
});
|
|
360
406
|
|
|
361
407
|
return this.validateResponse(response, 'createBank');
|
|
362
408
|
}
|
|
363
409
|
|
|
410
|
+
/**
|
|
411
|
+
* Set or update the reflect mission for a memory bank.
|
|
412
|
+
* @deprecated Use createBank({ reflectMission: '...' }) instead.
|
|
413
|
+
*/
|
|
414
|
+
async setMission(bankId: string, mission: string): Promise<BankProfileResponse> {
|
|
415
|
+
return this.createBank(bankId, { reflectMission: mission });
|
|
416
|
+
}
|
|
417
|
+
|
|
364
418
|
/**
|
|
365
419
|
* Get a bank's profile.
|
|
366
420
|
*/
|
|
@@ -373,17 +427,81 @@ export class HindsightClient {
|
|
|
373
427
|
return this.validateResponse(response, 'getBankProfile');
|
|
374
428
|
}
|
|
375
429
|
|
|
430
|
+
|
|
376
431
|
/**
|
|
377
|
-
*
|
|
432
|
+
* Get the resolved configuration for a bank, including any bank-level overrides.
|
|
433
|
+
*
|
|
434
|
+
* Can be disabled on the server by setting `HINDSIGHT_API_ENABLE_BANK_CONFIG_API=false`.
|
|
378
435
|
*/
|
|
379
|
-
async
|
|
380
|
-
const response = await sdk.
|
|
436
|
+
async getBankConfig(bankId: string): Promise<BankConfigResponse> {
|
|
437
|
+
const response = await sdk.getBankConfig({
|
|
438
|
+
client: this.client,
|
|
439
|
+
path: { bank_id: bankId },
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
return this.validateResponse(response, 'getBankConfig');
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Update configuration overrides for a bank.
|
|
447
|
+
*
|
|
448
|
+
* Can be disabled on the server by setting `HINDSIGHT_API_ENABLE_BANK_CONFIG_API=false`.
|
|
449
|
+
*
|
|
450
|
+
* @param bankId - The memory bank ID
|
|
451
|
+
* @param options - Fields to override
|
|
452
|
+
*/
|
|
453
|
+
async updateBankConfig(
|
|
454
|
+
bankId: string,
|
|
455
|
+
options: {
|
|
456
|
+
reflectMission?: string;
|
|
457
|
+
retainMission?: string;
|
|
458
|
+
retainExtractionMode?: string;
|
|
459
|
+
retainCustomInstructions?: string;
|
|
460
|
+
retainChunkSize?: number;
|
|
461
|
+
enableObservations?: boolean;
|
|
462
|
+
observationsMission?: string;
|
|
463
|
+
/** How skeptical vs trusting (1=trusting, 5=skeptical). */
|
|
464
|
+
dispositionSkepticism?: number;
|
|
465
|
+
/** How literally to interpret information (1=flexible, 5=literal). */
|
|
466
|
+
dispositionLiteralism?: number;
|
|
467
|
+
/** How much to consider emotional context (1=detached, 5=empathetic). */
|
|
468
|
+
dispositionEmpathy?: number;
|
|
469
|
+
},
|
|
470
|
+
): Promise<BankConfigResponse> {
|
|
471
|
+
const updates: Record<string, unknown> = {};
|
|
472
|
+
if (options.reflectMission !== undefined) updates.reflect_mission = options.reflectMission;
|
|
473
|
+
if (options.retainMission !== undefined) updates.retain_mission = options.retainMission;
|
|
474
|
+
if (options.retainExtractionMode !== undefined) updates.retain_extraction_mode = options.retainExtractionMode;
|
|
475
|
+
if (options.retainCustomInstructions !== undefined)
|
|
476
|
+
updates.retain_custom_instructions = options.retainCustomInstructions;
|
|
477
|
+
if (options.retainChunkSize !== undefined) updates.retain_chunk_size = options.retainChunkSize;
|
|
478
|
+
if (options.enableObservations !== undefined) updates.enable_observations = options.enableObservations;
|
|
479
|
+
if (options.observationsMission !== undefined) updates.observations_mission = options.observationsMission;
|
|
480
|
+
if (options.dispositionSkepticism !== undefined) updates.disposition_skepticism = options.dispositionSkepticism;
|
|
481
|
+
if (options.dispositionLiteralism !== undefined) updates.disposition_literalism = options.dispositionLiteralism;
|
|
482
|
+
if (options.dispositionEmpathy !== undefined) updates.disposition_empathy = options.dispositionEmpathy;
|
|
483
|
+
|
|
484
|
+
const response = await sdk.updateBankConfig({
|
|
485
|
+
client: this.client,
|
|
486
|
+
path: { bank_id: bankId },
|
|
487
|
+
body: { updates },
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
return this.validateResponse(response, 'updateBankConfig');
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Reset all bank-level configuration overrides, reverting to server defaults.
|
|
495
|
+
*
|
|
496
|
+
* Can be disabled on the server by setting `HINDSIGHT_API_ENABLE_BANK_CONFIG_API=false`.
|
|
497
|
+
*/
|
|
498
|
+
async resetBankConfig(bankId: string): Promise<BankConfigResponse> {
|
|
499
|
+
const response = await sdk.resetBankConfig({
|
|
381
500
|
client: this.client,
|
|
382
501
|
path: { bank_id: bankId },
|
|
383
|
-
body: { mission },
|
|
384
502
|
});
|
|
385
503
|
|
|
386
|
-
return this.validateResponse(response, '
|
|
504
|
+
return this.validateResponse(response, 'resetBankConfig');
|
|
387
505
|
}
|
|
388
506
|
|
|
389
507
|
/**
|
|
@@ -618,6 +736,7 @@ export type {
|
|
|
618
736
|
FileRetainResponse,
|
|
619
737
|
ListMemoryUnitsResponse,
|
|
620
738
|
BankProfileResponse,
|
|
739
|
+
BankConfigResponse,
|
|
621
740
|
CreateBankRequest,
|
|
622
741
|
Budget,
|
|
623
742
|
};
|