extrait 0.7.1 → 0.7.2

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
@@ -658,6 +658,8 @@ type MCPCallToolParams = {
658
658
  };
659
659
  ```
660
660
 
661
+ MCP toolsets may change between tool rounds. Providers call `listTools()` before each round, so a client can expose additional tools after a previous `callTool()` result, or remove tools that are no longer available.
662
+
661
663
  Use `transformToolCallParams()` when you need to attach MCP-specific metadata, override the final remote tool name, or otherwise change the full request passed to `client.callTool()`. This hook is exported as `LLMToolCallParamsTransformer`.
662
664
 
663
665
  ### Timeouts
package/dist/index.cjs CHANGED
@@ -58,6 +58,7 @@ __export(exports_src, {
58
58
  extractMarkdownCodeBlocks: () => extractMarkdownCodeBlocks,
59
59
  extractJsonCandidates: () => extractJsonCandidates,
60
60
  extractFirstMarkdownCode: () => extractFirstMarkdownCode,
61
+ dedent: () => dedent,
61
62
  createProviderRegistry: () => createProviderRegistry,
62
63
  createOpenAICompatibleAdapter: () => createOpenAICompatibleAdapter,
63
64
  createModelAdapter: () => createModelAdapter,
@@ -5624,7 +5625,7 @@ function toPromptString(value) {
5624
5625
  return String(value);
5625
5626
  }
5626
5627
  }
5627
- var dedent = createOutdent({
5628
+ var outdent = createOutdent({
5628
5629
  trimLeadingNewline: true,
5629
5630
  trimTrailingNewline: true,
5630
5631
  newline: `
@@ -5657,7 +5658,7 @@ function stripOuterBlankLines(text) {
5657
5658
  `);
5658
5659
  }
5659
5660
  function renderPromptTemplate(strings, values) {
5660
- return stripOuterBlankLines(dedent(strings, ...values.map(toPromptString)));
5661
+ return stripOuterBlankLines(outdent(strings, ...values.map(toPromptString)));
5661
5662
  }
5662
5663
  function isTemplateStringsArray(value) {
5663
5664
  return Array.isArray(value) && "raw" in value;
@@ -5705,6 +5706,9 @@ class PromptMessageBuilderImpl {
5705
5706
  function createPromptMessageBuilder() {
5706
5707
  return new PromptMessageBuilderImpl;
5707
5708
  }
5709
+ function dedent(strings, ...values) {
5710
+ return renderPromptTemplate(strings, values);
5711
+ }
5708
5712
  function prompt(input, ...values) {
5709
5713
  if (isTemplateStringsArray(input)) {
5710
5714
  return renderPromptTemplate(input, values);
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { formatZodIssues, parseLLMOutput } from "./parse";
8
8
  export { createMCPClient, wrapMCPClient, type CreateMCPClientOptions, type MCPClientInfo, type MCPInMemoryTransportConfig, type MCPStdioTransportConfig, type MCPStreamableHTTPTransportConfig, type MCPTransportConfig, type ManagedMCPToolClient, } from "./mcp";
9
9
  export { images, resizeImage, type ImageInput, type ImageSize } from "./image";
10
10
  export { conversation, type ConversationEntry } from "./conversation";
11
- export { prompt, type PromptMessageBuilder } from "./prompt";
11
+ export { dedent, prompt, type PromptMessageBuilder } from "./prompt";
12
12
  export { s, inspectSchemaMetadata, inferSchemaExample } from "./schema-builder";
13
13
  export { buildDefaultStructuredPrompt, DEFAULT_LOOSE_PARSE_OPTIONS, DEFAULT_SELF_HEAL_BY_MODE, DEFAULT_SELF_HEAL_CONTEXT_LABEL, DEFAULT_SELF_HEAL_FIX_INSTRUCTION, DEFAULT_SELF_HEAL_MAX_CONTEXT_CHARS, DEFAULT_SELF_HEAL_NO_ISSUES_MESSAGE, DEFAULT_SELF_HEAL_PROTOCOL, DEFAULT_SELF_HEAL_RAW_OUTPUT_LABEL, DEFAULT_SELF_HEAL_RETURN_INSTRUCTION, DEFAULT_SELF_HEAL_STOP_ON_NO_PROGRESS, DEFAULT_SELF_HEAL_VALIDATION_LABEL, DEFAULT_STRICT_PARSE_OPTIONS, DEFAULT_STRUCTURED_OBJECT_INSTRUCTION, DEFAULT_STRUCTURED_STYLE_INSTRUCTION, buildSelfHealPrompt, structured, StructuredParseError, type BuildDefaultStructuredPromptOptions, type SelfHealPromptTextOptions, } from "./structured";
14
14
  export { createOpenAICompatibleAdapter, type OpenAICompatibleAdapterOptions, } from "./providers/openai-compatible";
package/dist/index.js CHANGED
@@ -5538,7 +5538,7 @@ function toPromptString(value) {
5538
5538
  return String(value);
5539
5539
  }
5540
5540
  }
5541
- var dedent = createOutdent({
5541
+ var outdent = createOutdent({
5542
5542
  trimLeadingNewline: true,
5543
5543
  trimTrailingNewline: true,
5544
5544
  newline: `
@@ -5571,7 +5571,7 @@ function stripOuterBlankLines(text) {
5571
5571
  `);
5572
5572
  }
5573
5573
  function renderPromptTemplate(strings, values) {
5574
- return stripOuterBlankLines(dedent(strings, ...values.map(toPromptString)));
5574
+ return stripOuterBlankLines(outdent(strings, ...values.map(toPromptString)));
5575
5575
  }
5576
5576
  function isTemplateStringsArray(value) {
5577
5577
  return Array.isArray(value) && "raw" in value;
@@ -5619,6 +5619,9 @@ class PromptMessageBuilderImpl {
5619
5619
  function createPromptMessageBuilder() {
5620
5620
  return new PromptMessageBuilderImpl;
5621
5621
  }
5622
+ function dedent(strings, ...values) {
5623
+ return renderPromptTemplate(strings, values);
5624
+ }
5622
5625
  function prompt(input, ...values) {
5623
5626
  if (isTemplateStringsArray(input)) {
5624
5627
  return renderPromptTemplate(input, values);
@@ -5825,6 +5828,7 @@ export {
5825
5828
  extractMarkdownCodeBlocks,
5826
5829
  extractJsonCandidates,
5827
5830
  extractFirstMarkdownCode,
5831
+ dedent,
5828
5832
  createProviderRegistry,
5829
5833
  createOpenAICompatibleAdapter,
5830
5834
  createModelAdapter,
package/dist/prompt.d.ts CHANGED
@@ -10,5 +10,19 @@ export interface PromptMessageBuilder extends StructuredPromptResolver {
10
10
  assistant(content: LLMMessageContent): PromptMessageBuilder;
11
11
  build(): StructuredPromptPayload;
12
12
  }
13
+ /**
14
+ * Tagged template for formatting multi-line prompt strings: dedents the block
15
+ * and trims surrounding blank lines, so you can write readable indented
16
+ * templates instead of concatenating strings with `+`. Interpolated values are
17
+ * coerced the same way as in `prompt`. Returns a plain string — no role/message
18
+ * handling.
19
+ *
20
+ * @example
21
+ * const instructions = dedent`
22
+ * You are a helpful assistant.
23
+ * Answer in ${language} and keep responses concise.
24
+ * `;
25
+ */
26
+ export declare function dedent(strings: TemplateStringsArray, ...values: unknown[]): string;
13
27
  export declare function prompt(strings: TemplateStringsArray, ...values: unknown[]): string;
14
28
  export declare function prompt(): PromptMessageBuilder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extrait",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/tterrasson/extrait.git"