@frockbot/plugin-provider-ollama-cloud 0.3.14 → 0.3.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frockbot/plugin-provider-ollama-cloud",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -20,19 +20,19 @@
20
20
  "typecheck": "tsc --noEmit -p tsconfig.json"
21
21
  },
22
22
  "dependencies": {
23
- "@frockbot/configuration-core": "0.3.14",
24
- "@frockbot/connection-core": "0.3.14",
25
- "@frockbot/kernel-agent-loop": "0.3.14",
26
- "@frockbot/kernel-contracts": "0.3.14",
27
- "@frockbot/plugin-credentials": "0.3.14",
28
- "@frockbot/plugin-models": "0.3.14",
29
- "@frockbot/plugin-settings": "0.3.14",
30
- "@frockbot/plugin-web": "0.3.14",
31
- "@frockbot/provider-openai-compatible": "0.3.14",
23
+ "@frockbot/configuration-core": "0.3.15",
24
+ "@frockbot/connection-core": "0.3.15",
25
+ "@frockbot/kernel-agent-loop": "0.3.15",
26
+ "@frockbot/kernel-contracts": "0.3.15",
27
+ "@frockbot/plugin-credentials": "0.3.15",
28
+ "@frockbot/plugin-models": "0.3.15",
29
+ "@frockbot/plugin-settings": "0.3.15",
30
+ "@frockbot/plugin-web": "0.3.15",
31
+ "@frockbot/provider-openai-compatible": "0.3.15",
32
32
  "cordis": "4.0.0-rc.8"
33
33
  },
34
34
  "devDependencies": {
35
- "@frockbot/plugin-tools": "0.3.14",
35
+ "@frockbot/plugin-tools": "0.3.15",
36
36
  "@types/bun": "1.3.6",
37
37
  "typescript": "^7.0.2"
38
38
  },
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test } from "bun:test";
2
2
  import {
3
- LlmEffectNotStartedError,
3
+ ModelProviderFailureError,
4
4
  MODEL_FIRST_BYTE_DEADLINE_MS_V1,
5
5
  MODEL_FIRST_BYTE_DEADLINE_REASON_V1,
6
6
  MODEL_IDLE_DEADLINE_MS_V1,
@@ -247,7 +247,7 @@ describe("Ollama Cloud runtime Contribution", () => {
247
247
  failure = error;
248
248
  }
249
249
 
250
- expect(failure).toBeInstanceOf(LlmEffectNotStartedError);
250
+ expect(failure).toBeInstanceOf(ModelProviderFailureError);
251
251
  expect(openCount).toBe(0);
252
252
  expect(settled).toEqual(["effect-1"]);
253
253
  await root.fiber.dispose();
@@ -361,7 +361,7 @@ describe("Ollama Cloud runtime Contribution", () => {
361
361
  failure = error;
362
362
  }
363
363
 
364
- expect(failure).toBeInstanceOf(LlmEffectNotStartedError);
364
+ expect(failure).toBeInstanceOf(ModelProviderFailureError);
365
365
  expect(leaseCount).toBe(0);
366
366
  await root.fiber.dispose();
367
367
  });
@@ -449,7 +449,10 @@ describe("Ollama Cloud runtime Contribution", () => {
449
449
  } catch (error) {
450
450
  failure = error;
451
451
  }
452
- expect(failure).toBeInstanceOf(LlmEffectNotStartedError);
452
+ expect(failure).toBeInstanceOf(ModelProviderFailureError);
453
+ expect((failure as ModelProviderFailureError).classification).toBe(
454
+ "permanent",
455
+ );
453
456
  expect(settled).toEqual([]);
454
457
  await root.serial(
455
458
  "agent/model-outcome-committed",
@@ -516,7 +519,10 @@ describe("Ollama Cloud runtime Contribution", () => {
516
519
  failure = error;
517
520
  }
518
521
 
519
- expect(failure).toBeInstanceOf(LlmEffectNotStartedError);
522
+ expect(failure).toBeInstanceOf(ModelProviderFailureError);
523
+ expect((failure as ModelProviderFailureError).classification).toBe(
524
+ "transient",
525
+ );
520
526
  expect(settled).toEqual([]);
521
527
  await root.fiber.dispose();
522
528
  },
@@ -730,7 +736,7 @@ describe("Ollama Cloud deadlines", () => {
730
736
  // before the first event as definitive. That matters more than the class
731
737
  // name — a deadline reported as uncertain would park the run on a
732
738
  // retrieval nobody can perform. The reason still reaches the person.
733
- expect(failure).toBeInstanceOf(LlmEffectNotStartedError);
739
+ expect(failure).toBeInstanceOf(ModelProviderFailureError);
734
740
  expect((failure as Error).message).toBe(
735
741
  MODEL_FIRST_BYTE_DEADLINE_REASON_V1,
736
742
  );
package/src/runtime.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
- LlmEffectNotStartedError,
3
2
  type LlmProvider,
4
3
  type LlmReconciliationCapability,
4
+ ModelProviderFailureError,
5
5
  type NormalizedModelRequest,
6
6
  } from "@frockbot/kernel-contracts";
7
7
  import { type Agent } from "@frockbot/kernel-agent-loop/agent";
@@ -94,16 +94,18 @@ class OllamaCloudProvider implements LlmProvider {
94
94
  !expectedGeneration ||
95
95
  binding.connectionId !== this.config.connectionId
96
96
  ) {
97
- throw new LlmEffectNotStartedError(
98
- "Ollama Cloud request has invalid Connection authority",
99
- );
97
+ throw new ModelProviderFailureError({
98
+ classification: "permanent",
99
+ reason: "Ollama Cloud request has invalid Connection authority",
100
+ });
100
101
  }
101
102
  const existing = this.authorized.get(request.requestId);
102
103
  if (existing) {
103
104
  if (existing.lease.credentialGeneration !== expectedGeneration) {
104
- throw new LlmEffectNotStartedError(
105
- "Ollama Cloud request generation changed",
106
- );
105
+ throw new ModelProviderFailureError({
106
+ classification: "permanent",
107
+ reason: "Ollama Cloud request generation changed",
108
+ });
107
109
  }
108
110
  return;
109
111
  }
@@ -135,11 +137,13 @@ class OllamaCloudProvider implements LlmProvider {
135
137
  .settleCredential(request.requestId)
136
138
  .catch(() => undefined);
137
139
  }
138
- throw new LlmEffectNotStartedError(
139
- error instanceof Error
140
- ? error.message
141
- : "Ollama Cloud credential is unavailable",
142
- );
140
+ throw new ModelProviderFailureError({
141
+ classification: "unknown",
142
+ reason:
143
+ error instanceof Error
144
+ ? error.message
145
+ : "Ollama Cloud credential is unavailable",
146
+ });
143
147
  }
144
148
  }
145
149
 
@@ -168,9 +172,10 @@ class OllamaCloudProvider implements LlmProvider {
168
172
  await this.authorize(request);
169
173
  const authorization = this.authorized.get(request.requestId);
170
174
  if (!authorization) {
171
- throw new LlmEffectNotStartedError(
172
- "Ollama Cloud request authorization is unavailable",
173
- );
175
+ throw new ModelProviderFailureError({
176
+ classification: "permanent",
177
+ reason: "Ollama Cloud request authorization is unavailable",
178
+ });
174
179
  }
175
180
  const provider = new OpenAICompatibleProvider({
176
181
  baseUrl: this.config.chatBaseUrl ?? ollamaChatBaseUrl(),
@@ -197,11 +202,14 @@ class OllamaCloudProvider implements LlmProvider {
197
202
  }
198
203
  } catch (error) {
199
204
  if (started || signal.aborted) throw error;
200
- throw new LlmEffectNotStartedError(
201
- error instanceof OpenAICompatibleHttpError || error instanceof Error
202
- ? error.message
203
- : "Ollama Cloud request did not reach the provider",
204
- );
205
+ if (error instanceof ModelProviderFailureError) throw error;
206
+ throw new ModelProviderFailureError({
207
+ classification: "unknown",
208
+ reason:
209
+ error instanceof OpenAICompatibleHttpError || error instanceof Error
210
+ ? error.message
211
+ : "Ollama Cloud request did not reach the provider",
212
+ });
205
213
  }
206
214
  }
207
215
  }