@opencode/ai 0.0.0-dev-20250 → 0.0.0-dev-20251

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
@@ -129,8 +129,9 @@ VercelAIGateway.configure().experimental.evaluation("typesafe-ai/jev")
129
129
 
130
130
  OpenRouter reads `OPENROUTER_API_KEY`. Vercel reads `AI_GATEWAY_API_KEY`, then `VERCEL_OIDC_TOKEN`.
131
131
  The common API uses `boolean`; System One routes lower it to native `noul`.
132
- Choice and score confidence plus score legends remain available in provider metadata, and the
133
- provider's rounded probabilities are returned unchanged.
132
+ Choice and score answers include `confidence` when the provider returns it, such as
133
+ `response.answers.department.confidence`. Score legends remain available in provider metadata, and
134
+ the provider's rounded probabilities are returned unchanged.
134
135
 
135
136
  ## Alibaba Cloud Model Studio
136
137
 
@@ -54,12 +54,14 @@ export declare const ChoiceAnswer: Schema.Struct<{
54
54
  readonly type: Schema.Literal<"choice">;
55
55
  readonly choice: Schema.String;
56
56
  readonly probabilities: Schema.optional<Schema.$Record<Schema.String, Schema.Number>>;
57
+ readonly confidence: Schema.optional<Schema.Number>;
57
58
  }>;
58
59
  export type ChoiceAnswer = Schema.Schema.Type<typeof ChoiceAnswer>;
59
60
  export declare const ScoreAnswer: Schema.Struct<{
60
61
  readonly type: Schema.Literal<"score">;
61
62
  readonly score: Schema.Number;
62
63
  readonly probabilities: Schema.optional<Schema.$Record<Schema.String, Schema.Number>>;
64
+ readonly confidence: Schema.optional<Schema.Number>;
63
65
  }>;
64
66
  export type ScoreAnswer = Schema.Schema.Type<typeof ScoreAnswer>;
65
67
  export declare const BooleanAnswer: Schema.Struct<{
@@ -71,10 +73,12 @@ export declare const EvaluationAnswer: Schema.toTaggedUnion<"type", readonly [Sc
71
73
  readonly type: Schema.Literal<"choice">;
72
74
  readonly choice: Schema.String;
73
75
  readonly probabilities: Schema.optional<Schema.$Record<Schema.String, Schema.Number>>;
76
+ readonly confidence: Schema.optional<Schema.Number>;
74
77
  }>, Schema.Struct<{
75
78
  readonly type: Schema.Literal<"score">;
76
79
  readonly score: Schema.Number;
77
80
  readonly probabilities: Schema.optional<Schema.$Record<Schema.String, Schema.Number>>;
81
+ readonly confidence: Schema.optional<Schema.Number>;
78
82
  }>, Schema.Struct<{
79
83
  readonly type: Schema.Literal<"boolean">;
80
84
  readonly probability: Schema.Number;
@@ -87,6 +91,7 @@ export type AnswerFor<Question extends EvaluationQuestion> = Question extends {
87
91
  readonly type: "choice";
88
92
  readonly choice: Extract<keyof Criteria, string>;
89
93
  readonly probabilities?: Readonly<Record<Extract<keyof Criteria, string>, number>>;
94
+ readonly confidence?: number;
90
95
  } : Question extends {
91
96
  readonly type: "score";
92
97
  } ? ScoreAnswer : BooleanAnswer;
@@ -206,10 +211,12 @@ declare const EvaluationResponse_base: Schema.Class<EvaluationResponse, Schema.S
206
211
  readonly type: Schema.Literal<"choice">;
207
212
  readonly choice: Schema.String;
208
213
  readonly probabilities: Schema.optional<Schema.$Record<Schema.String, Schema.Number>>;
214
+ readonly confidence: Schema.optional<Schema.Number>;
209
215
  }>, Schema.Struct<{
210
216
  readonly type: Schema.Literal<"score">;
211
217
  readonly score: Schema.Number;
212
218
  readonly probabilities: Schema.optional<Schema.$Record<Schema.String, Schema.Number>>;
219
+ readonly confidence: Schema.optional<Schema.Number>;
213
220
  }>, Schema.Struct<{
214
221
  readonly type: Schema.Literal<"boolean">;
215
222
  readonly probability: Schema.Number;
@@ -33,11 +33,13 @@ export const ChoiceAnswer = Schema.Struct({
33
33
  type: Schema.Literal("choice"),
34
34
  choice: Schema.String,
35
35
  probabilities: Schema.optional(Schema.Record(Schema.String, Probability)),
36
+ confidence: Schema.optional(Probability),
36
37
  });
37
38
  export const ScoreAnswer = Schema.Struct({
38
39
  type: Schema.Literal("score"),
39
40
  score: Schema.Number,
40
41
  probabilities: Schema.optional(Schema.Record(Schema.String, Probability)),
42
+ confidence: Schema.optional(Probability),
41
43
  });
42
44
  export const BooleanAnswer = Schema.Struct({
43
45
  type: Schema.Literal("boolean"),
@@ -80,34 +80,37 @@ export const model = (cfg) => EvaluationModel.make({
80
80
  const fail = (message, cause, body) => new AIError({ reason: new InvalidProviderOutputError({ route: "system-one", message, body, http, cause }) });
81
81
  const text = yield* res.text.pipe(Effect.mapError((cause) => fail("Failed to read the System One response", cause)));
82
82
  const data = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Response))(text).pipe(Effect.mapError((cause) => fail("System One returned an invalid response", cause, text)));
83
- const confidence = {};
84
83
  const legend = {};
85
84
  const answers = Object.fromEntries(Object.entries(data.answers).map(([id, answer]) => {
86
85
  if (answer.type === "noul")
87
86
  return [id, { type: "boolean", probability: answer.noul }];
88
87
  if (answer.type === "choice") {
89
- if (answer.confidence !== undefined)
90
- confidence[id] = answer.confidence;
91
88
  return [
92
89
  id,
93
90
  {
94
91
  type: "choice",
95
92
  choice: answer.choice,
96
93
  probabilities: answer.probabilities,
94
+ ...(answer.confidence === undefined ? {} : { confidence: answer.confidence }),
97
95
  },
98
96
  ];
99
97
  }
100
- if (answer.confidence !== undefined)
101
- confidence[id] = answer.confidence;
102
98
  if (answer.legend !== undefined)
103
99
  legend[id] = answer.legend;
104
- return [id, { type: "score", score: answer.score, probabilities: answer.probabilities }];
100
+ return [
101
+ id,
102
+ {
103
+ type: "score",
104
+ score: answer.score,
105
+ probabilities: answer.probabilities,
106
+ ...(answer.confidence === undefined ? {} : { confidence: answer.confidence }),
107
+ },
108
+ ];
105
109
  }));
106
110
  const meta = {
107
111
  ...(data.id === undefined ? {} : { responseId: data.id }),
108
112
  ...(data.provider === undefined ? {} : { provider: data.provider }),
109
113
  ...data.provider_metadata?.[cfg.providerMetadataKey],
110
- ...(Object.keys(confidence).length === 0 ? {} : { confidence }),
111
114
  ...(Object.keys(legend).length === 0 ? {} : { legend }),
112
115
  };
113
116
  return new EvaluationResponse({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-dev-20250",
3
+ "version": "0.0.0-dev-20251",
4
4
  "name": "@opencode/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "devDependencies": {
35
35
  "@clack/prompts": "1.0.0-alpha.1",
36
36
  "@effect/platform-node": "4.0.0-rc.112",
37
- "@opencode/http-recorder": "0.0.0-dev-20250",
37
+ "@opencode/http-recorder": "0.0.0-dev-20251",
38
38
  "@tsconfig/bun": "1.0.9",
39
39
  "@types/bun": "1.4.0",
40
40
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
@@ -44,7 +44,7 @@
44
44
  "@aws-sdk/credential-providers": "3.1057.0",
45
45
  "@smithy/eventstream-codec": "4.2.14",
46
46
  "@smithy/util-utf8": "4.2.2",
47
- "@opencode/schema": "0.0.0-dev-20250",
47
+ "@opencode/schema": "0.0.0-dev-20251",
48
48
  "aws4fetch": "1.0.20",
49
49
  "effect": "4.0.0-rc.112",
50
50
  "google-auth-library": "10.5.0"