extrait 0.3.1 → 0.5.1

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/prompt.d.ts CHANGED
@@ -4,6 +4,8 @@ export interface PromptMessageBuilder extends StructuredPromptResolver {
4
4
  system(strings: TemplateStringsArray, ...values: unknown[]): PromptMessageBuilder;
5
5
  user(input: string): PromptMessageBuilder;
6
6
  user(strings: TemplateStringsArray, ...values: unknown[]): PromptMessageBuilder;
7
+ assistant(input: string): PromptMessageBuilder;
8
+ assistant(strings: TemplateStringsArray, ...values: unknown[]): PromptMessageBuilder;
7
9
  build(): StructuredPromptPayload;
8
10
  }
9
11
  export declare function prompt(strings: TemplateStringsArray, ...values: unknown[]): string;
package/dist/types.d.ts CHANGED
@@ -119,9 +119,14 @@ export interface MCPToolClient {
119
119
  callTool(params: MCPCallToolParams): Promise<unknown>;
120
120
  close?(): Promise<void>;
121
121
  }
122
+ export interface LLMMessage {
123
+ role: "system" | "user" | "assistant" | "tool";
124
+ content: unknown;
125
+ }
122
126
  export interface LLMRequest {
123
- prompt: string;
127
+ prompt?: string;
124
128
  systemPrompt?: string;
129
+ messages?: LLMMessage[];
125
130
  temperature?: number;
126
131
  maxTokens?: number;
127
132
  mcpClients?: MCPToolClient[];
@@ -130,9 +135,11 @@ export interface LLMRequest {
130
135
  maxToolRounds?: number;
131
136
  onToolExecution?: (execution: LLMToolExecution) => void;
132
137
  transformToolOutput?: LLMToolOutputTransformer;
138
+ transformToolArguments?: LLMToolArgumentsTransformer;
133
139
  unknownToolError?: (toolName: string) => string;
134
140
  toolDebug?: boolean | LLMToolDebugOptions;
135
141
  body?: Record<string, unknown>;
142
+ signal?: AbortSignal;
136
143
  }
137
144
  export interface LLMUsage {
138
145
  inputTokens?: number;
@@ -192,6 +199,11 @@ export interface LLMToolExecution {
192
199
  durationMs?: number;
193
200
  }
194
201
  export type LLMToolOutputTransformer = (output: unknown, execution: Omit<LLMToolExecution, "output" | "durationMs">) => unknown | Promise<unknown>;
202
+ export type LLMToolArgumentsTransformer = (args: Record<string, unknown>, context: {
203
+ name: string;
204
+ remoteName: string;
205
+ clientId: string;
206
+ }) => Record<string, unknown> | Promise<Record<string, unknown>>;
195
207
  export interface LLMToolDebugOptions {
196
208
  enabled?: boolean;
197
209
  logger?: (line: string) => void;
@@ -217,8 +229,9 @@ export interface StructuredPromptContext {
217
229
  mode: StructuredMode;
218
230
  }
219
231
  export interface StructuredPromptPayload {
220
- prompt: string;
232
+ prompt?: string;
221
233
  systemPrompt?: string;
234
+ messages?: LLMMessage[];
222
235
  }
223
236
  export interface StructuredPromptResolver {
224
237
  resolvePrompt(context: StructuredPromptContext): StructuredPromptPayload;
@@ -262,7 +275,7 @@ export interface StructuredCallOptions<TSchema extends z.ZodTypeAny> {
262
275
  debug?: boolean | StructuredDebugOptions;
263
276
  observe?: (event: StructuredTraceEvent) => void;
264
277
  systemPrompt?: string;
265
- request?: Omit<LLMRequest, "prompt" | "systemPrompt">;
278
+ request?: Omit<LLMRequest, "prompt" | "systemPrompt" | "messages">;
266
279
  schemaInstruction?: string;
267
280
  }
268
281
  export interface StructuredOptions<TSchema extends z.ZodTypeAny> extends StructuredCallOptions<TSchema> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extrait",
3
- "version": "0.3.1",
3
+ "version": "0.5.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,15 +36,21 @@
36
36
  "prepublishOnly": "bun run lint && bun run build && bun run build:types",
37
37
  "test": "bun test tests/ --reporter=dots --only-failures",
38
38
  "typecheck": "bunx tsc --noEmit",
39
- "pack": "bun run build && npm pack"
39
+ "pack": "bun run build:types && bun run build && npm pack"
40
40
  },
41
41
  "dependencies": {
42
- "@modelcontextprotocol/sdk": "^1.26.0",
42
+ "@modelcontextprotocol/sdk": "^1.27.1",
43
43
  "jsonrepair": "^3.13.2",
44
- "zod": "^3.25.76"
44
+ "zod": "^4.3.6"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/bun": "latest",
47
+ "@types/bun": "^1.3.10",
48
48
  "typescript": "^5.9.3"
49
+ },
50
+ "overrides": {
51
+ "zod": "^4.3.6"
52
+ },
53
+ "resolutions": {
54
+ "zod": "^4.3.6"
49
55
  }
50
56
  }