@outputai/core 0.15.1-next.c2756ea.0 → 0.15.1-next.de5fa8c.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.
@@ -3,4 +3,4 @@ export { setProvider } from './provider_registry.js';
3
3
  export { encrypt, decrypt, generateKey } from './encryption.js';
4
4
  export { InvalidCredentialsKeyError, MalformedCredentialsKeyError, MissingCredentialError, MissingKeyError } from './errors.js';
5
5
  export { getNestedValue, resolveCredentialsPath, resolveKeyPath, resolveKeyEnvVar, resolveWorkflowCredentialsPath, resolveWorkflowKeyPath, resolveWorkflowKeyEnvVar } from './paths.js';
6
- export type { CredentialsProvider } from './types.js';
6
+ export type { CredentialsGlobalContext, CredentialsProvider, CredentialsWorkflowContext } from './types.js';
@@ -1,12 +1,12 @@
1
- export interface GlobalContext {
1
+ export interface CredentialsGlobalContext {
2
2
  environment: string | undefined;
3
3
  }
4
- export interface WorkflowContext {
4
+ export interface CredentialsWorkflowContext {
5
5
  workflowName: string;
6
6
  workflowDir: string | undefined;
7
7
  environment?: string | undefined;
8
8
  }
9
9
  export interface CredentialsProvider {
10
- loadGlobal(context: GlobalContext): Record<string, unknown>;
11
- loadForWorkflow(context: WorkflowContext): Record<string, unknown> | null;
10
+ loadGlobal(context: CredentialsGlobalContext): Record<string, unknown>;
11
+ loadForWorkflow(context: CredentialsWorkflowContext): Record<string, unknown> | null;
12
12
  }
@@ -2,6 +2,6 @@ export { evalWorkflow } from './eval_workflow.js';
2
2
  export type { EvalDefinition, EvalWorkflowConfig, EvalWorkflowInput, EvalWorkflowFn, EvalWorkflowOptions } from './eval_workflow.js';
3
3
  export { Verdict } from './verdict.js';
4
4
  export { verify } from './verify.js';
5
- export type { CheckContext } from './verify.js';
5
+ export type { CheckContext, CheckFn, VerifyOptions } from './verify.js';
6
6
  export { VERDICT, CRITICALITY, EvalOutputSchema, DatasetSchema } from './schemas.js';
7
7
  export type { Verdict as VerdictType, Criticality, InterpretConfig, EvaluatorResult, EvalCase, EvalSummary, EvalOutput, GroundTruth, LastOutput, LastEval, Dataset } from './schemas.js';
@@ -7,8 +7,10 @@ export type CheckContext<TInput = unknown, TOutput = unknown> = {
7
7
  ground_truth: Record<string, unknown>;
8
8
  };
9
9
  };
10
- type CheckFn<TInput, TOutput> = (ctx: CheckContext<TInput, TOutput>) => EvaluationResult | Promise<EvaluationResult>;
11
- type VerifyOptions<I extends z.ZodType = z.ZodType<unknown>, O extends z.ZodType = z.ZodType<unknown>> = {
10
+ /** Evaluation function accepted by {@link verify}. */
11
+ export type CheckFn<TInput = unknown, TOutput = unknown> = (ctx: CheckContext<TInput, TOutput>) => EvaluationResult | Promise<EvaluationResult>;
12
+ /** Options accepted by {@link verify}. */
13
+ export type VerifyOptions<I extends z.ZodType = z.ZodType<unknown>, O extends z.ZodType = z.ZodType<unknown>> = {
12
14
  name: string;
13
15
  input?: I;
14
16
  output?: O;
@@ -38,4 +40,3 @@ export declare const verify: <I extends z.ZodType, O extends z.ZodType>(options:
38
40
  optin: "optional" | "defaulted";
39
41
  };
40
42
  } ? k_1 : never]?: T_2[k_1]["_zod"]["input"] | undefined; } : never) extends infer T ? { [K in keyof T]: T[K]; } : never) => Promise<EvaluationResult>;
41
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outputai/core",
3
- "version": "0.15.1-next.c2756ea.0",
3
+ "version": "0.15.1-next.de5fa8c.0",
4
4
  "description": "The core module of the output framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -76,9 +76,9 @@
76
76
  "winston": "3.19.0"
77
77
  },
78
78
  "peerDependencies": {
79
- "zod": ">=4.3 <5",
79
+ "zod": ">=4.6.6 <5",
80
80
  "ky": ">=2 <3",
81
- "undici": ">=8 <9",
81
+ "undici": ">=8.12.2 <9",
82
82
  "ai": ">=7 <8",
83
83
  "@ai-sdk/amazon-bedrock": ">=5 <6",
84
84
  "@ai-sdk/anthropic": ">=4 <5",
@@ -109,9 +109,9 @@
109
109
  },
110
110
  "devDependencies": {
111
111
  "@types/js-yaml": "4.0.9",
112
- "zod": "4.6.5",
112
+ "zod": "4.6.6",
113
113
  "ky": "2.0.2",
114
- "undici": "8.10.2",
114
+ "undici": "8.12.3",
115
115
  "ai": "7.0.112",
116
116
  "@ai-sdk/amazon-bedrock": "5.0.92",
117
117
  "@ai-sdk/anthropic": "4.0.61",
@@ -1,10 +1,8 @@
1
1
  import type * as undici from 'undici';
2
2
 
3
- type NodeRequestInfo = string | URL | globalThis.Request;
4
- type NodeRequestInit = globalThis.RequestInit & Pick<undici.RequestInit, 'dispatcher'>;
5
-
6
- type OutputFetch = {
7
- ( input: NodeRequestInfo, init?: NodeRequestInit ): Promise<Response>;
3
+ /** Fetch function supporting Node and Undici request types. */
4
+ export type OutputFetch = {
5
+ ( input: string | URL | globalThis.Request, init?: globalThis.RequestInit & Pick<undici.RequestInit, 'dispatcher'> ): Promise<Response>;
8
6
  ( input: undici.RequestInfo, init?: undici.RequestInit ): Promise<Response>;
9
7
  };
10
8
 
@@ -17,6 +17,7 @@ export type HttpRequestCostEvent = {
17
17
  };
18
18
 
19
19
  export { outputFetch } from './fetch/index.js';
20
+ export type { OutputFetch } from './fetch/index.js';
20
21
  export { HTTPRequestCount } from './fetch/logger.js';
21
22
  export { createKyClient } from './ky/index.js';
22
23
 
@@ -8,3 +8,4 @@ export * from './evaluator.js';
8
8
  export * from './workflow.js';
9
9
  export * from './evaluation_result.js';
10
10
  export * from './logger.js';
11
+ export type { AnyZodSchema, DeepPartial, TemporalActivityOptions } from './types.js';
@@ -193,12 +193,8 @@ export type Prompt = {
193
193
  instructions: string | null;
194
194
  };
195
195
 
196
- type AnyAiOutput = AIOutputNamespace.Output<unknown, unknown, unknown>;
197
- type DefaultRuntimeContext = Record<string, unknown>;
198
- type CompatibleToolSchemaKey = 'inputSchema' | 'outputSchema' | 'contextSchema';
199
- type WithoutToolSchemaBrands<T> = T extends unknown ? {
200
- [K in keyof T]: K extends CompatibleToolSchemaKey ? unknown : T[K];
201
- } : never;
196
+ /** Any AI SDK structured output specification. */
197
+ export type AnyAiOutput = AIOutputNamespace.Output<unknown, unknown, unknown>;
202
198
 
203
199
  /**
204
200
  * Structurally-compatible AI SDK 7 tool shape.
@@ -206,12 +202,17 @@ type WithoutToolSchemaBrands<T> = T extends unknown ? {
206
202
  * This derives from AI SDK's `ToolSet` and widens only schema fields so tools from packages
207
203
  * resolved with a different Zod peer instance remain assignable.
208
204
  */
209
- export type CompatibleTool = WithoutToolSchemaBrands<ToolSet[string]>;
205
+ export type CompatibleTool = ToolSet[string] extends infer Tool ?
206
+ Tool extends unknown ? {
207
+ [K in keyof Tool]: K extends 'inputSchema' | 'outputSchema' | 'contextSchema' ? unknown : Tool[K];
208
+ } : never :
209
+ never;
210
210
 
211
211
  /** AI SDK tools accepted by Output APIs without requiring one exact Zod peer instance. */
212
212
  export type CompatibleToolSet = Record<string, CompatibleTool>;
213
213
 
214
- type PromptFileCallOptions = {
214
+ /** Options for an LLM call using a prompt file. */
215
+ export type PromptFileCallOptions = {
215
216
  /** Prompt file name (e.g. 'summary@v1') */
216
217
  prompt: string;
217
218
  /** Variables to interpolate into the prompt file */
@@ -220,7 +221,8 @@ type PromptFileCallOptions = {
220
221
  promptDir?: string;
221
222
  };
222
223
 
223
- type PromptObjectCallOptions = {
224
+ /** Options for an LLM call using a loaded or custom prompt. */
225
+ export type PromptObjectCallOptions = {
224
226
  /** Loaded or custom prompt object. */
225
227
  prompt: Prompt;
226
228
  /** Prompt objects are already rendered and cannot receive interpolation variables. */
@@ -229,13 +231,16 @@ type PromptObjectCallOptions = {
229
231
  promptDir?: never;
230
232
  };
231
233
 
232
- type PromptCallOptions = PromptFileCallOptions | PromptObjectCallOptions;
234
+ /** Prompt file or loaded prompt options accepted by LLM calls. */
235
+ export type PromptCallOptions = PromptFileCallOptions | PromptObjectCallOptions;
233
236
 
234
- type StopWhen<Tools extends ToolSet = ToolSet> =
235
- StopCondition<NoInfer<Tools>, DefaultRuntimeContext> |
236
- Array<StopCondition<NoInfer<Tools>, DefaultRuntimeContext>>;
237
+ /** Stop conditions accepted by text generation calls. */
238
+ export type StopWhen<Tools extends ToolSet = ToolSet> =
239
+ StopCondition<NoInfer<Tools>, Record<string, unknown>> |
240
+ Array<StopCondition<NoInfer<Tools>, Record<string, unknown>>>;
237
241
 
238
- type TextCallOptions<
242
+ /** Shared options accepted by text generation calls. */
243
+ export type TextCallOptions<
239
244
  Tools extends ToolSet = ToolSet,
240
245
  OutputSpec extends AnyAiOutput = AnyAiOutput
241
246
  > = PromptCallOptions & {
@@ -290,7 +295,8 @@ export type GenerateImageInput =
290
295
  mediaType?: string;
291
296
  };
292
297
 
293
- type GenerateImageInputs =
298
+ /** Image and mask inputs accepted by image generation calls. */
299
+ export type GenerateImageInputs =
294
300
  | {
295
301
  /** Runtime image inputs for image-to-image generation */
296
302
  images: GenerateImageInput[];
@@ -346,7 +352,7 @@ export type OutputAgentStreamParameters = OutputAgentGenerateWithStreamingParame
346
352
  * `ai` does not export a named `Source` type.
347
353
  */
348
354
  export type ExtractedSource =
349
- AIGenerateTextResult<ToolSet, DefaultRuntimeContext, AnyAiOutput>['sources'][number];
355
+ AIGenerateTextResult<ToolSet, Record<string, unknown>, AnyAiOutput>['sources'][number];
350
356
 
351
357
  export type LLMGenerationUsageStatus = 'complete' | 'incomplete';
352
358
 
@@ -437,7 +443,7 @@ export interface LLMGenerationMeteringEvent {
437
443
  * `onEnd` payload plus `result`, `cost`, and merged `sources`.
438
444
  */
439
445
  export type WrappedStreamTextOnEndEvent<Tools extends ToolSet = ToolSet> =
440
- Parameters<GenerateTextOnEndCallback<Tools, DefaultRuntimeContext>>[0] & {
446
+ Parameters<GenerateTextOnEndCallback<Tools, Record<string, unknown>>>[0] & {
441
447
  result: string;
442
448
  cost: LLMGenerationCost | null;
443
449
  sources: ExtractedSource[];
@@ -455,7 +461,7 @@ export type WrappedStreamTextOnEndCallback<Tools extends ToolSet = ToolSet> = (
455
461
  export type GenerateTextResult<
456
462
  Tools extends ToolSet = ToolSet,
457
463
  OutputSpec extends AnyAiOutput = AnyAiOutput
458
- > = AIGenerateTextResult<Tools, DefaultRuntimeContext, OutputSpec> & {
464
+ > = AIGenerateTextResult<Tools, Record<string, unknown>, OutputSpec> & {
459
465
  /** Unified field name alias for 'text' */
460
466
  result: string;
461
467
  /** Calculated cost for the LLM call; `null` when pricing data is not available */
@@ -617,7 +623,7 @@ export function streamText<
617
623
  OutputSpec extends AnyAiOutput = AnyAiOutput
618
624
  >(
619
625
  args: StreamTextParameters<Tools, OutputSpec>
620
- ): AIStreamTextResult<Tools, DefaultRuntimeContext, OutputSpec>;
626
+ ): AIStreamTextResult<Tools, Record<string, unknown>, OutputSpec>;
621
627
 
622
628
  /**
623
629
  * Use an image model to generate images from a prompt filename or object.
@@ -686,6 +692,6 @@ export declare class Agent<
686
692
  * `onEnd` receives {@link WrappedStreamTextOnEndEvent} (`result`, `cost`, `sources`), matching {@link streamText}.
687
693
  */
688
694
  stream( options?: OutputAgentStreamParameters ): Promise<
689
- AIStreamTextResult<ToolSet, DefaultRuntimeContext, OutputSpec>
695
+ AIStreamTextResult<ToolSet, Record<string, unknown>, OutputSpec>
690
696
  >;
691
697
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "_meta": {
3
- "createdAt": "2026-10-19T06:24:47.766Z"
3
+ "createdAt": "2026-11-02T06:16:58.558Z"
4
4
  },
5
5
  "amazon-bedrock": {
6
6
  "models": {
@@ -325,6 +325,15 @@
325
325
  },
326
326
  "reasoning": true
327
327
  },
328
+ "au.anthropic.claude-sonnet-5-5": {
329
+ "cost": {
330
+ "input": 2.2,
331
+ "output": 11,
332
+ "cache_read": 0.11,
333
+ "cache_write": 2.75
334
+ },
335
+ "reasoning": true
336
+ },
328
337
  "ca.amazon.nova-lite-v1:0": {
329
338
  "cost": {
330
339
  "input": 0.064,
@@ -890,6 +899,33 @@
890
899
  },
891
900
  "reasoning": true
892
901
  },
902
+ "global.openai.gpt-6.1-terra": {
903
+ "cost": {
904
+ "input": 1,
905
+ "output": 5,
906
+ "cache_read": 0.05,
907
+ "cache_write": 1.25,
908
+ "tiers": [
909
+ {
910
+ "input": 2,
911
+ "output": 7.5,
912
+ "cache_read": 0.1,
913
+ "cache_write": 2.5,
914
+ "tier": {
915
+ "type": "context",
916
+ "size": 272000
917
+ }
918
+ }
919
+ ],
920
+ "context_over_200k": {
921
+ "input": 2,
922
+ "output": 7.5,
923
+ "cache_read": 0.1,
924
+ "cache_write": 2.5
925
+ }
926
+ },
927
+ "reasoning": true
928
+ },
893
929
  "global.xai.grok-4.6": {
894
930
  "cost": {
895
931
  "input": 2,
@@ -1506,6 +1542,33 @@
1506
1542
  },
1507
1543
  "reasoning": true
1508
1544
  },
1545
+ "openai.gpt-6.1-terra": {
1546
+ "cost": {
1547
+ "input": 1.1,
1548
+ "output": 5.5,
1549
+ "cache_read": 0.055,
1550
+ "cache_write": 1.375,
1551
+ "tiers": [
1552
+ {
1553
+ "input": 2.2,
1554
+ "output": 8.25,
1555
+ "cache_read": 0.11,
1556
+ "cache_write": 2.75,
1557
+ "tier": {
1558
+ "type": "context",
1559
+ "size": 272000
1560
+ }
1561
+ }
1562
+ ],
1563
+ "context_over_200k": {
1564
+ "input": 2.2,
1565
+ "output": 8.25,
1566
+ "cache_read": 0.11,
1567
+ "cache_write": 2.75
1568
+ }
1569
+ },
1570
+ "reasoning": true
1571
+ },
1509
1572
  "openai.gpt-oss-120b": {
1510
1573
  "cost": {
1511
1574
  "input": 0.15,
@@ -2059,6 +2122,33 @@
2059
2122
  },
2060
2123
  "reasoning": true
2061
2124
  },
2125
+ "us.openai.gpt-6.1-terra": {
2126
+ "cost": {
2127
+ "input": 1.1,
2128
+ "output": 5.5,
2129
+ "cache_read": 0.055,
2130
+ "cache_write": 1.375,
2131
+ "tiers": [
2132
+ {
2133
+ "input": 2.2,
2134
+ "output": 8.25,
2135
+ "cache_read": 0.11,
2136
+ "cache_write": 2.75,
2137
+ "tier": {
2138
+ "type": "context",
2139
+ "size": 272000
2140
+ }
2141
+ }
2142
+ ],
2143
+ "context_over_200k": {
2144
+ "input": 2.2,
2145
+ "output": 8.25,
2146
+ "cache_read": 0.11,
2147
+ "cache_write": 2.75
2148
+ }
2149
+ },
2150
+ "reasoning": true
2151
+ },
2062
2152
  "us.writer.palmyra-x4-v1:0": {
2063
2153
  "cost": {
2064
2154
  "input": 2.5,
@@ -2379,15 +2469,6 @@
2379
2469
  },
2380
2470
  "reasoning": true
2381
2471
  },
2382
- "claude-opus-4-1": {
2383
- "cost": {
2384
- "input": 15,
2385
- "output": 75,
2386
- "cache_read": 1.5,
2387
- "cache_write": 18.75
2388
- },
2389
- "reasoning": true
2390
- },
2391
2472
  "claude-opus-4-5": {
2392
2473
  "cost": {
2393
2474
  "input": 5,
@@ -2557,13 +2638,6 @@
2557
2638
  },
2558
2639
  "reasoning": false
2559
2640
  },
2560
- "deepseek-r1": {
2561
- "cost": {
2562
- "input": 1.35,
2563
- "output": 5.4
2564
- },
2565
- "reasoning": true
2566
- },
2567
2641
  "deepseek-v3.2": {
2568
2642
  "cost": {
2569
2643
  "input": 0.58,
@@ -2592,6 +2666,14 @@
2592
2666
  },
2593
2667
  "reasoning": true
2594
2668
  },
2669
+ "deepseek-v4.1-flash": {
2670
+ "cost": {
2671
+ "input": 0.3,
2672
+ "output": 1.2,
2673
+ "cache_read": 0.006
2674
+ },
2675
+ "reasoning": true
2676
+ },
2595
2677
  "gpt-3.5-turbo-0125": {
2596
2678
  "cost": {
2597
2679
  "input": 0.5,
@@ -2671,7 +2753,7 @@
2671
2753
  "cost": {
2672
2754
  "input": 1.25,
2673
2755
  "output": 10,
2674
- "cache_read": 0.13
2756
+ "cache_read": 0.125
2675
2757
  },
2676
2758
  "reasoning": true
2677
2759
  },
@@ -2679,7 +2761,7 @@
2679
2761
  "cost": {
2680
2762
  "input": 1.25,
2681
2763
  "output": 10,
2682
- "cache_read": 0.13
2764
+ "cache_read": 0.125
2683
2765
  },
2684
2766
  "reasoning": true
2685
2767
  },
@@ -2687,7 +2769,7 @@
2687
2769
  "cost": {
2688
2770
  "input": 0.25,
2689
2771
  "output": 2,
2690
- "cache_read": 0.03
2772
+ "cache_read": 0.025
2691
2773
  },
2692
2774
  "reasoning": true
2693
2775
  },
@@ -2695,7 +2777,7 @@
2695
2777
  "cost": {
2696
2778
  "input": 0.05,
2697
2779
  "output": 0.4,
2698
- "cache_read": 0.01
2780
+ "cache_read": 0.005
2699
2781
  },
2700
2782
  "reasoning": true
2701
2783
  },
@@ -2742,7 +2824,7 @@
2742
2824
  "cost": {
2743
2825
  "input": 1.75,
2744
2826
  "output": 14,
2745
- "cache_read": 0.125
2827
+ "cache_read": 0.175
2746
2828
  },
2747
2829
  "reasoning": true
2748
2830
  },
@@ -2878,14 +2960,14 @@
2878
2960
  "cost": {
2879
2961
  "input": 4,
2880
2962
  "output": 20,
2881
- "cache_read": 0.5,
2882
- "cache_write": 6.25,
2963
+ "cache_read": 0.4,
2964
+ "cache_write": 5,
2883
2965
  "tiers": [
2884
2966
  {
2885
- "input": 10,
2886
- "output": 45,
2887
- "cache_read": 1,
2888
- "cache_write": 12.5,
2967
+ "input": 8,
2968
+ "output": 30,
2969
+ "cache_read": 0.8,
2970
+ "cache_write": 10,
2889
2971
  "tier": {
2890
2972
  "type": "context",
2891
2973
  "size": 272000
@@ -2893,10 +2975,10 @@
2893
2975
  }
2894
2976
  ],
2895
2977
  "context_over_200k": {
2896
- "input": 10,
2897
- "output": 45,
2898
- "cache_read": 1,
2899
- "cache_write": 12.5
2978
+ "input": 8,
2979
+ "output": 30,
2980
+ "cache_read": 0.8,
2981
+ "cache_write": 10
2900
2982
  }
2901
2983
  },
2902
2984
  "reasoning": true
@@ -3036,6 +3118,33 @@
3036
3118
  },
3037
3119
  "reasoning": true
3038
3120
  },
3121
+ "gpt-6.1-terra": {
3122
+ "cost": {
3123
+ "input": 1,
3124
+ "output": 5,
3125
+ "cache_read": 0.05,
3126
+ "cache_write": 1.25,
3127
+ "tiers": [
3128
+ {
3129
+ "input": 2,
3130
+ "output": 7.5,
3131
+ "cache_read": 0.1,
3132
+ "cache_write": 2.5,
3133
+ "tier": {
3134
+ "type": "context",
3135
+ "size": 272000
3136
+ }
3137
+ }
3138
+ ],
3139
+ "context_over_200k": {
3140
+ "input": 2,
3141
+ "output": 7.5,
3142
+ "cache_read": 0.1,
3143
+ "cache_write": 2.5
3144
+ }
3145
+ },
3146
+ "reasoning": true
3147
+ },
3039
3148
  "gpt-chat-latest": {
3040
3149
  "cost": {
3041
3150
  "input": 5,
@@ -4071,14 +4180,6 @@
4071
4180
  },
4072
4181
  "reasoning": true
4073
4182
  },
4074
- "gpt-5.2-chat-latest": {
4075
- "cost": {
4076
- "input": 1.75,
4077
- "output": 14,
4078
- "cache_read": 0.175
4079
- },
4080
- "reasoning": false
4081
- },
4082
4183
  "gpt-5.2-pro": {
4083
4184
  "cost": {
4084
4185
  "input": 21,
@@ -4086,14 +4187,6 @@
4086
4187
  },
4087
4188
  "reasoning": true
4088
4189
  },
4089
- "gpt-5.3-chat-latest": {
4090
- "cost": {
4091
- "input": 1.75,
4092
- "output": 14,
4093
- "cache_read": 0.175
4094
- },
4095
- "reasoning": false
4096
- },
4097
4190
  "gpt-5.3-codex": {
4098
4191
  "cost": {
4099
4192
  "input": 1.75,
@@ -4432,6 +4525,33 @@
4432
4525
  },
4433
4526
  "reasoning": true
4434
4527
  },
4528
+ "gpt-6.1-terra": {
4529
+ "cost": {
4530
+ "input": 1,
4531
+ "output": 5,
4532
+ "cache_read": 0.05,
4533
+ "cache_write": 1.25,
4534
+ "tiers": [
4535
+ {
4536
+ "input": 2,
4537
+ "output": 7.5,
4538
+ "cache_read": 0.1,
4539
+ "cache_write": 2.5,
4540
+ "tier": {
4541
+ "type": "context",
4542
+ "size": 272000
4543
+ }
4544
+ }
4545
+ ],
4546
+ "context_over_200k": {
4547
+ "input": 2,
4548
+ "output": 7.5,
4549
+ "cache_read": 0.1,
4550
+ "cache_write": 2.5
4551
+ }
4552
+ },
4553
+ "reasoning": true
4554
+ },
4435
4555
  "gpt-daybreak-blue-latest": {
4436
4556
  "cost": {
4437
4557
  "input": 4,
@@ -19,8 +19,22 @@ const createWorkflowsEntrypoint = workflows => {
19
19
  aliases.map( alias => ( { name: alias, path } ) )
20
20
  );
21
21
 
22
- const content = [ ...workflows, ...aliasExports, catalog ]
23
- .map( ( { name, path } ) => `export { default as ${name} } from '${path}';` ).join( EOL );
22
+ // A static re-export makes every cached workflow evaluate the whole catalog: Temporal's reusable VM
23
+ // keeps each module loaded during an activation in that workflow's own cache. A lazy export loads
24
+ // only the invoked workflow; eager mode keeps it in the same bundle. Workflow type resolution is by
25
+ // export name, and the metadata the framework reads is read in Node, never from the bundle.
26
+ const lazyExports = [ ...workflows, ...aliasExports ].map( ( { name, path } ) => `\
27
+ async function _${name}( ...args ) {
28
+ const { default: workflow } = await import( /* webpackMode: "eager" */ '${path}' );
29
+ if ( typeof workflow !== 'function' ) {
30
+ throw new TypeError( 'Workflow "${name}" must be exported as default.' );
31
+ }
32
+ return workflow( ...args );
33
+ }
34
+ export { _${name} as ${name} };` );
35
+
36
+ // The catalog stays static: it is the framework's own workflow, small, and always loaded.
37
+ const content = [ ...lazyExports, `export { default as ${catalog.name} } from '${catalog.path}';` ].join( EOL );
24
38
 
25
39
  return writeFileInTempDir( content, WORKFLOWS_INDEX_FILENAME );
26
40
  };