@e2e-dev/decision 0.1.0 → 0.2.0-nightly-20261008205824

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
@@ -31,6 +31,9 @@ single target dispatch without a question. The text model is also the agent's
31
31
  judgment tier (`waitFor`, `extract`); without a text model or a configured agent
32
32
  `model`, `type` is never offered.
33
33
 
34
+ `providerOptions` go with every decide call and reach the decision model
35
+ only; the text model keeps the agents entry's `providerOptions`.
36
+
34
37
  The runner authorizes every dispatched action and records every model call
35
38
  against the step budget. Secrets stay declared handles filled only through
36
39
  `typeSecret`; password fields never reach the text model. `minProbability`
package/dist/.build.json CHANGED
@@ -1 +1 @@
1
- {"version":"0.1.0"}
1
+ {"version":"0.2.0-nightly-20261008205824"}
package/dist/decide.d.ts CHANGED
@@ -19,4 +19,4 @@ export interface Decision {
19
19
  * This is the only file that touches the SDK decide API, so a rename
20
20
  * there stays a one-file change.
21
21
  */
22
- export declare function decide(ctx: StepExecutorContext, model: DecisionExecutorOptions['model'], request: DecisionRequest): Promise<Record<string, Decision>>;
22
+ export declare function decide(ctx: StepExecutorContext, model: DecisionExecutorOptions['model'], request: DecisionRequest, providerOptions?: DecisionExecutorOptions['providerOptions']): Promise<Record<string, Decision>>;
package/dist/decide.js CHANGED
@@ -20,7 +20,7 @@ export function requireDecide() {
20
20
  * This is the only file that touches the SDK decide API, so a rename
21
21
  * there stays a one-file change.
22
22
  */
23
- export async function decide(ctx, model, request) {
23
+ export async function decide(ctx, model, request, providerOptions) {
24
24
  ctx.signal.throwIfAborted();
25
25
  const started = performance.now();
26
26
  const startedAt = new Date().toISOString();
@@ -30,7 +30,12 @@ export async function decide(ctx, model, request) {
30
30
  let providerMetadata;
31
31
  let answers;
32
32
  try {
33
- const call = { model, state: request.state, questions: request.questions };
33
+ const call = {
34
+ model,
35
+ state: request.state,
36
+ questions: request.questions,
37
+ ...(providerOptions === undefined ? {} : { providerOptions }),
38
+ };
34
39
  const result = await requireDecide()({
35
40
  ...call,
36
41
  maxRetries: 0,
package/dist/executor.js CHANGED
@@ -20,6 +20,9 @@ export function decisionExecutor(options) {
20
20
  if (!inUnit(minProbability) || !inUnit(minConfidence)) {
21
21
  throw new ConfigurationError('INVALID_CONFIG', 'decisionExecutor({ minProbability, minConfidence }) must be between 0 and 1');
22
22
  }
23
+ if (options.providerOptions !== undefined && !isOptionsRecord(options.providerOptions)) {
24
+ throw new ConfigurationError('INVALID_CONFIG', 'decisionExecutor({ providerOptions }) maps provider names to option objects, e.g. { gateway: { zeroDataRetention: true } }');
25
+ }
23
26
  const textModel = options.textModel;
24
27
  return {
25
28
  name: 'decision',
@@ -59,6 +62,16 @@ function checkModel(model) {
59
62
  throw new ConfigurationError('INVALID_CONFIG', `decisionExecutor({ model }) got ${name}, which does not answer choice questions`);
60
63
  }
61
64
  }
65
+ /** A plain object whose every value is a plain object: the shape the AI SDK takes as providerOptions. */
66
+ function isOptionsRecord(value) {
67
+ const isRecord = (v) => {
68
+ if (typeof v !== 'object' || v === null)
69
+ return false;
70
+ const prototype = Object.getPrototypeOf(v);
71
+ return prototype === Object.prototype || prototype === null;
72
+ };
73
+ return isRecord(value) && Object.values(value).every(isRecord);
74
+ }
62
75
  function inUnit(value) {
63
76
  return Number.isFinite(value) && value >= 0 && value <= 1;
64
77
  }
@@ -97,7 +110,7 @@ async function run(ctx, options, minProbability, minConfidence) {
97
110
  return undefined;
98
111
  transcript.push(JSON.stringify({ state: request.state, questions: request.questions }));
99
112
  calls += 1;
100
- const answers = await decide(ctx, model, request);
113
+ const answers = await decide(ctx, model, request, options.providerOptions);
101
114
  transcript.push(JSON.stringify(answers));
102
115
  return answers;
103
116
  };
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Experimental_DecisionModel, LanguageModel } from 'ai';
1
+ import type { experimental_decide, Experimental_DecisionModel, LanguageModel } from 'ai';
2
2
  /** Options for an executor that acts through a decision model and writes field text with a language model. */
3
3
  export interface DecisionExecutorOptions {
4
4
  /**
@@ -20,4 +20,11 @@ export interface DecisionExecutorOptions {
20
20
  readonly minProbability?: number;
21
21
  /** Minimum provider-reported confidence. Default 0 (off). A model that reports none counts as 0. */
22
22
  readonly minConfidence?: number;
23
+ /**
24
+ * Provider options sent with every decide call, such as
25
+ * `{ gateway: { zeroDataRetention: true } }` for Vercel AI Gateway. They reach
26
+ * the decision model only: the text model keeps the agents entry's
27
+ * `providerOptions`, so options meant for one model never reach the other.
28
+ */
29
+ readonly providerOptions?: Parameters<typeof experimental_decide>[0]['providerOptions'];
23
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e2e-dev/decision",
3
- "version": "0.1.0",
3
+ "version": "0.2.0-nightly-20261008205824",
4
4
  "description": "Decision-model executors for e2e",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -29,16 +29,16 @@
29
29
  },
30
30
  "peerDependencies": {
31
31
  "ai": "^7.0.128",
32
- "e2e": ">=0.15.2 <1"
32
+ "e2e": "0.19.0-nightly-20261008205824"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@ai-sdk/typesafe-ai": "3.0.13",
36
- "@e2e-dev/web": "0.13.0",
36
+ "@e2e-dev/web": "0.14.0-nightly-20261008205824",
37
37
  "@types/node": "26.6.2",
38
38
  "ai": "7.0.128",
39
39
  "ajv": "8.20.0",
40
40
  "ajv-formats": "3.0.1",
41
- "e2e": "0.18.0",
41
+ "e2e": "0.19.0-nightly-20261008205824",
42
42
  "typescript": "7.0.2",
43
43
  "vitest": "5.0.1"
44
44
  },