@tstdl/base 0.93.130 → 0.93.131

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.
@@ -11,7 +11,7 @@ export type InstructionOverride = string | {
11
11
  /**
12
12
  * Advanced way: Provide full custom instructions.
13
13
  */
14
- content?: string;
14
+ content?: string | Instructions;
15
15
  /**
16
16
  * Strategy for 'content'. Defaults to 'append'.
17
17
  */
@@ -9,7 +9,7 @@ var DocumentManagementAiService_1;
9
9
  import { and, isNull as drizzleIsNull, eq, inArray } from 'drizzle-orm';
10
10
  import { P, match } from 'ts-pattern';
11
11
  import { genkitGenerationOptions, injectGenkit, injectModel } from '../../../ai/genkit/index.js';
12
- import { buildPrompts, jsonOutputInstructions, orderedList } from '../../../ai/prompts/index.js';
12
+ import { buildPrompts, formatInstructions, jsonOutputInstructions, orderedList } from '../../../ai/prompts/index.js';
13
13
  import { inject } from '../../../injector/inject.js';
14
14
  import { Logger } from '../../../logger/logger.js';
15
15
  import { arrayAgg } from '../../../orm/index.js';
@@ -497,11 +497,12 @@ export function mergeInstructions(base, overrides, options = {}) {
497
497
  }
498
498
  if (isDefined(override.content)) {
499
499
  const strategy = override.strategy ?? 'append';
500
+ const content = isString(override.content) ? override.content : formatInstructions(override.content);
500
501
  if (strategy == 'replace') {
501
- result = override.content;
502
+ result = content;
502
503
  }
503
504
  else {
504
- result = `${result}\n\n${override.content}`;
505
+ result = `${result}\n\n${content}`;
505
506
  }
506
507
  }
507
508
  }
@@ -35,4 +35,12 @@ describe('AI Instruction Merging', () => {
35
35
  const result = mergeInstructions(base, overrides);
36
36
  expect(result).toContain('[ID] - [Name]');
37
37
  });
38
+ test('should handle Instructions in content', () => {
39
+ const base = 'Base';
40
+ const overrides = [{ content: { Detail: 'More info' }, strategy: 'append' }];
41
+ const result = mergeInstructions(base, overrides);
42
+ expect(result).toContain('Base');
43
+ expect(result).toContain('# Detail');
44
+ expect(result).toContain('More info');
45
+ });
38
46
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.93.130",
3
+ "version": "0.93.131",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"