@opencode/ai 0.0.0-dev-56 → 0.0.0-dev-57

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/llm.d.ts CHANGED
@@ -24,8 +24,8 @@ export type LoopInput<SelectedLanguageModel extends LanguageModel = LanguageMode
24
24
  }) => boolean;
25
25
  };
26
26
  /**
27
- * Stream model calls, running the model's tool calls between them, until a step has no client-executed tool calls or
28
- * `until` returns `true`. Each step's `step-start` and `step-finish` carry its step index.
27
+ * Stream model calls, running the model's tool calls between them, until a step has no client-executed tool calls,
28
+ * reports a provider error, or `until` returns `true`. Each step's `step-start` and `step-finish` carry its step index.
29
29
  */
30
30
  export declare function loop<const Model extends LanguageModel>(input: LoopInput<Model>, options?: StreamOptions): Stream.Stream<LLMEvent, AIError, Service>;
31
31
  export declare const request: <const SelectedLanguageModel extends LanguageModel>(input: RequestInput<SelectedLanguageModel>) => LLMRequest<SelectedLanguageModel>;
package/dist/llm.js CHANGED
@@ -17,7 +17,7 @@ export function loop(input, options) {
17
17
  return LLMClient.stream(request, options).pipe(Stream.map((event) => event.type === "step-start" || event.type === "step-finish" ? { ...event, index: steps.length } : event), Stream.tap((event) => Effect.sync(() => events.push(event))), Stream.concat(Stream.unwrap(Effect.gen(function* () {
18
18
  const response = LLMResponse.fromEvents(events);
19
19
  const calls = response?.toolCalls.filter((call) => call.providerExecuted !== true) ?? [];
20
- if (!response || calls.length === 0)
20
+ if (!response || calls.length === 0 || events.some(LLMEvent.is.providerError))
21
21
  return Stream.empty;
22
22
  const done = [...steps, response];
23
23
  if (until?.({ steps: done }))
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-56",
3
+ "version": "0.0.0-dev-57",
4
4
  "name": "@opencode/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -532,7 +532,7 @@
532
532
  "devDependencies": {
533
533
  "@clack/prompts": "1.0.0-alpha.1",
534
534
  "@effect/platform-node": "4.0.1",
535
- "@opencode/http-recorder": "0.0.0-dev-56",
535
+ "@opencode/http-recorder": "0.0.0-dev-57",
536
536
  "@tsconfig/bun": "1.0.9",
537
537
  "@types/bun": "1.4.3",
538
538
  "@typescript/native": "npm:typescript@7.1.0-beta",
@@ -542,7 +542,7 @@
542
542
  "@aws-sdk/credential-providers": "3.1057.0",
543
543
  "@smithy/eventstream-codec": "4.2.14",
544
544
  "@smithy/util-utf8": "4.2.2",
545
- "@opencode/schema": "0.0.0-dev-56",
545
+ "@opencode/schema": "0.0.0-dev-57",
546
546
  "aws4fetch": "1.0.20",
547
547
  "effect": "4.0.1",
548
548
  "google-auth-library": "10.5.0"