@haatlabs-core/ai 0.11.3 → 0.12.1

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
@@ -10,6 +10,9 @@ against the caller's zod schema. It throws `AI_PROVIDER_ERROR`; a project spread
10
10
  `createEmbeddingProvider(config, { rateLimit })` embeds text and images, with retry and a turn
11
11
  before each request; `cosineSimilarity`.
12
12
 
13
+ **`@haatlabs-core/ai/contracts`** (0.12.1): `AI_ERRORS`, `AiErrorCode`, `createAiError` and
14
+ the `AiError` type, with nothing of Node: a project's contracts, which its pages load, import from here and never the root, which is for Node.
15
+
13
16
  ## Install
14
17
 
15
18
  pnpm add @haatlabs-core/ai
@@ -0,0 +1 @@
1
+ export * from './codes.js';
@@ -0,0 +1,21 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var contracts_exports = {};
16
+ module.exports = __toCommonJS(contracts_exports);
17
+ __reExport(contracts_exports, require("./codes.js"), module.exports);
18
+ // Annotate the CommonJS export names for ESM import in node:
19
+ 0 && (module.exports = {
20
+ ...require("./codes.js")
21
+ });
@@ -0,0 +1 @@
1
+ export * from './codes.js';
@@ -0,0 +1,6 @@
1
+ // What a project's contracts, which its browser code also loads, may take from this package:
2
+ // its error code.
3
+ // Nothing here loads a Node built-in or a server client: scripts/check-browser.mjs bundles
4
+ // it for a browser and runs it.
5
+ export * from './codes.js';
6
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,kBAAkB;AAClB,2FAA2F;AAC3F,gCAAgC;AAChC,cAAc,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haatlabs-core/ai",
3
- "version": "0.11.3",
3
+ "version": "0.12.1",
4
4
  "description": "Text from an OpenAI-compatible chat endpoint, with retries, a rate limit and zod-checked answers.",
5
5
  "keywords": [
6
6
  "haatlabs",
@@ -35,18 +35,33 @@
35
35
  "types": "./dist/cjs/index.d.ts",
36
36
  "default": "./dist/cjs/index.js"
37
37
  }
38
+ },
39
+ "./contracts": {
40
+ "import": {
41
+ "types": "./dist/contracts.d.ts",
42
+ "default": "./dist/contracts.js"
43
+ },
44
+ "require": {
45
+ "types": "./dist/cjs/contracts.d.ts",
46
+ "default": "./dist/cjs/contracts.js"
47
+ }
38
48
  }
39
49
  },
50
+ "haatlabs": {
51
+ "browser": [
52
+ "./contracts"
53
+ ]
54
+ },
40
55
  "dependencies": {
41
- "@haatlabs-core/errors": "0.11.3",
42
- "@haatlabs-core/observability": "0.11.3",
43
- "@haatlabs-core/providers": "0.11.3"
56
+ "@haatlabs-core/errors": "0.12.1",
57
+ "@haatlabs-core/observability": "0.12.1",
58
+ "@haatlabs-core/providers": "0.12.1"
44
59
  },
45
60
  "devDependencies": {
46
61
  "@opentelemetry/sdk-trace-node": "^2.11.0",
47
62
  "zod": "^4.6.5",
48
- "@haatlabs-core/vitest-config": "0.11.3",
49
- "@haatlabs-core/tsconfig": "0.11.3"
63
+ "@haatlabs-core/vitest-config": "0.12.1",
64
+ "@haatlabs-core/tsconfig": "0.12.1"
50
65
  },
51
66
  "peerDependencies": {
52
67
  "zod": "^4.6.5"