veryfront 0.1.858 → 0.1.859

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.858",
3
+ "version": "0.1.859",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -1 +1 @@
1
- {"version":3,"file":"provider-errors.d.ts","sourceRoot":"","sources":["../../../src/src/chat/provider-errors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAiBD,4CAA4C;AAC5C,MAAM,MAAM,mBAAmB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAE7F,0CAA0C;AAC1C,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAMhE;AAgBD,iCAAiC;AACjC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,mBAAmB,GAAG,IAAI,CA0B/E;AAED,yCAAyC;AACzC,wBAAgB,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAOvE;AAgFD,sCAAsC;AACtC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAEtE"}
1
+ {"version":3,"file":"provider-errors.d.ts","sourceRoot":"","sources":["../../../src/src/chat/provider-errors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA8BD,4CAA4C;AAC5C,MAAM,MAAM,mBAAmB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAE7F,0CAA0C;AAC1C,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAMhE;AAgBD,iCAAiC;AACjC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,mBAAmB,GAAG,IAAI,CA+B/E;AAED,yCAAyC;AACzC,wBAAgB,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAOvE;AA2FD,sCAAsC;AACtC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAEtE"}
@@ -6,6 +6,15 @@ const PROJECT_SCHEMA_ERROR = {
6
6
  code: "PROJECT_SCHEMA_ERROR",
7
7
  message: "Project code has an invalid Veryfront schema. Update the schema to use defineSchema(), then run the agent again.",
8
8
  };
9
+ const MODEL_UNSUPPORTED_ASSISTANT_PREFILL_ERROR = {
10
+ code: "MODEL_UNSUPPORTED_ASSISTANT_PREFILL",
11
+ message: "The selected model does not support assistant-message prefill. Start a new user message or choose a compatible model.",
12
+ };
13
+ const AI_PROVIDER_SPEND_LIMIT_ERROR = {
14
+ code: "AI_PROVIDER_SPEND_LIMIT_EXCEEDED",
15
+ message: "The AI provider spend limit has been reached. Try again later or ask an administrator to raise the AI provider spend limit.",
16
+ status: 402,
17
+ };
9
18
  function isErrorRecord(value) {
10
19
  return typeof value === "object" && value !== null && !Array.isArray(value);
11
20
  }
@@ -37,6 +46,10 @@ export function parseKnownProblemBody(body) {
37
46
  const slug = typeof body.slug === "string" ? body.slug : null;
38
47
  const error = typeof body.error === "string" ? body.error : null;
39
48
  const suggestion = typeof body.suggestion === "string" ? body.suggestion : null;
49
+ const normalizedProblemText = `${error ?? ""} ${suggestion ?? ""}`.toLowerCase();
50
+ if (normalizedProblemText.includes("ai provider spend limit")) {
51
+ return AI_PROVIDER_SPEND_LIMIT_ERROR;
52
+ }
40
53
  if (slug === "insufficient-credits" || error === "AI credit limit exceeded") {
41
54
  return {
42
55
  code: "INSUFFICIENT_CREDITS",
@@ -68,6 +81,9 @@ function parseKnownProviderBody(body) {
68
81
  if (!isErrorRecord(body)) {
69
82
  return null;
70
83
  }
84
+ if (body.type === "error" && isErrorRecord(body.error)) {
85
+ return parseKnownProviderBody(body.error);
86
+ }
71
87
  if (body.type === "overloaded_error") {
72
88
  return {
73
89
  code: "OVERLOADED_ERROR",
@@ -97,6 +113,10 @@ function parseKnownProviderBody(body) {
97
113
  body.message.includes("too long")) {
98
114
  return { code: "CONTEXT_LENGTH_EXCEEDED", message: "Conversation is too long" };
99
115
  }
116
+ if (body.type === "invalid_request_error" && typeof body.message === "string" &&
117
+ body.message.toLowerCase().includes("does not support assistant message prefill")) {
118
+ return MODEL_UNSUPPORTED_ASSISTANT_PREFILL_ERROR;
119
+ }
100
120
  return null;
101
121
  }
102
122
  function getErrorMessage(error) {
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.858";
2
+ export declare const VERSION = "0.1.859";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.858";
4
+ export const VERSION = "0.1.859";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.858",
3
+ "version": "0.1.859",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",