@bedrockio/ai 0.9.3 → 0.9.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.9.5
2
+
3
+ - Export all clients.
4
+ - Error if template directory incorrect.
5
+
6
+ ## 0.9.4
7
+
8
+ - Bumped yada dev version.
9
+
1
10
  ## 0.9.3
2
11
 
3
12
  - Further fixes for empty input.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_fs_1 = require("node:fs");
3
4
  const templates_1 = require("@bedrockio/templates");
4
5
  const code_js_1 = require("./utils/code.js");
5
6
  const json_js_1 = require("./utils/json.js");
@@ -13,6 +14,13 @@ class BaseClient {
13
14
  this.renderer = new templates_1.TemplateRenderer({
14
15
  dir: options.templates,
15
16
  });
17
+ this.assertTemplatesDir();
18
+ }
19
+ assertTemplatesDir() {
20
+ const { templates } = this.options;
21
+ if (templates && !(0, node_fs_1.existsSync)(templates)) {
22
+ throw new Error(`Directory not found: ${templates}`);
23
+ }
16
24
  }
17
25
  // Public
18
26
  /**
package/dist/cjs/index.js CHANGED
@@ -3,12 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.McpServer = void 0;
6
+ exports.XAiClient = exports.OpenAiClient = exports.GoogleClient = exports.AnthropicClient = exports.McpServer = void 0;
7
7
  exports.createClient = createClient;
8
8
  const anthropic_js_1 = require("./anthropic.js");
9
+ Object.defineProperty(exports, "AnthropicClient", { enumerable: true, get: function () { return anthropic_js_1.AnthropicClient; } });
9
10
  const google_js_1 = require("./google.js");
11
+ Object.defineProperty(exports, "GoogleClient", { enumerable: true, get: function () { return google_js_1.GoogleClient; } });
10
12
  const openai_js_1 = require("./openai.js");
13
+ Object.defineProperty(exports, "OpenAiClient", { enumerable: true, get: function () { return openai_js_1.OpenAiClient; } });
11
14
  const xai_js_1 = require("./xai.js");
15
+ Object.defineProperty(exports, "XAiClient", { enumerable: true, get: function () { return xai_js_1.XAiClient; } });
12
16
  var McpServer_js_1 = require("./McpServer.js");
13
17
  Object.defineProperty(exports, "McpServer", { enumerable: true, get: function () { return __importDefault(McpServer_js_1).default; } });
14
18
  function createClient(options = {}) {
@@ -1,3 +1,4 @@
1
+ import { existsSync } from 'node:fs';
1
2
  import { TemplateRenderer } from '@bedrockio/templates';
2
3
  import { parseCode } from './utils/code.js';
3
4
  import { createMessageExtractor } from './utils/json.js';
@@ -11,6 +12,13 @@ export default class BaseClient {
11
12
  this.renderer = new TemplateRenderer({
12
13
  dir: options.templates,
13
14
  });
15
+ this.assertTemplatesDir();
16
+ }
17
+ assertTemplatesDir() {
18
+ const { templates } = this.options;
19
+ if (templates && !existsSync(templates)) {
20
+ throw new Error(`Directory not found: ${templates}`);
21
+ }
14
22
  }
15
23
  // Public
16
24
  /**
package/dist/esm/index.js CHANGED
@@ -24,3 +24,4 @@ export function createClient(options = {}) {
24
24
  throw new Error(`Unknown platform "${platform}".`);
25
25
  }
26
26
  }
27
+ export { AnthropicClient, GoogleClient, OpenAiClient, XAiClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/ai",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "description": "Bedrock wrapper for common AI chatbots.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -44,7 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@bedrockio/eslint-plugin": "^1.2.2",
46
46
  "@bedrockio/prettier-config": "^1.0.2",
47
- "@bedrockio/yada": "^1.8.3",
47
+ "@bedrockio/yada": "^1.11.0",
48
48
  "eslint": "^9.36.0",
49
49
  "tsc-alias": "^1.8.16",
50
50
  "typescript": "^5.9.3",
@@ -2,6 +2,7 @@ export default class BaseClient {
2
2
  constructor(options: any);
3
3
  options: any;
4
4
  renderer: TemplateRenderer;
5
+ assertTemplatesDir(): void;
5
6
  /**
6
7
  * Interpolates vars into the provided template as instructions and runs the
7
8
  * prompt.
@@ -1 +1 @@
1
- {"version":3,"file":"BaseClient.d.ts","sourceRoot":"","sources":["../src/BaseClient.js"],"names":[],"mappings":"AAKA;IACE,0BASC;IARC,aAIC;IACD,2BAEE;IAKJ;;;;;OAKG;IACH,gBAFW,aAAa,gBAiCvB;IAED;;;;;OAKG;IACH,gBAHW,aAAa,GAAG,aAAa,gCAsDvC;IAED;;;;OAIG;IACH,wBAFW,MAAM,OAIhB;IAED,uCAKC;IAID,8BAGC;IAED,8BAGC;IAED,qCAGC;IAED;;OAEG;IACH,0CAGC;IAED;;OAEG;IACH,oDAIC;IAED;;OAEG;IACH,oDAIC;IAID;;OAEG;IACH,oCAOC;IAED;;;MAeC;IAED,4CAiDC;IAED,uCAkCC;IAED;;;MA4BC;IAED,uDAWC;IAED,kDAMC;CACF;;;;;WAIa,MAAM;kBACN,MAAM;;;;cACN,aAAa,EAAE;;;;YACf,MAAM;;;;YACN,OAAO;;;;;;;;aAEP,MAAM,GAAG,MAAM;;;;;;;;;;;sBAOf,MAAM;;;UAKN,QAAQ,GAAG,MAAM,GAAG,WAAW;aAC/B,MAAM;;iCA/Wa,sBAAsB"}
1
+ {"version":3,"file":"BaseClient.d.ts","sourceRoot":"","sources":["../src/BaseClient.js"],"names":[],"mappings":"AAOA;IACE,0BAUC;IATC,aAIC;IACD,2BAEE;IAIJ,2BAKC;IAID;;;;;OAKG;IACH,gBAFW,aAAa,gBAiCvB;IAED;;;;;OAKG;IACH,gBAHW,aAAa,GAAG,aAAa,gCAsDvC;IAED;;;;OAIG;IACH,wBAFW,MAAM,OAIhB;IAED,uCAKC;IAID,8BAGC;IAED,8BAGC;IAED,qCAGC;IAED;;OAEG;IACH,0CAGC;IAED;;OAEG;IACH,oDAIC;IAED;;OAEG;IACH,oDAIC;IAID;;OAEG;IACH,oCAOC;IAED;;;MAeC;IAED,4CAiDC;IAED,uCAkCC;IAED;;;MA4BC;IAED,uDAWC;IAED,kDAMC;CACF;;;;;WAIa,MAAM;kBACN,MAAM;;;;cACN,aAAa,EAAE;;;;YACf,MAAM;;;;YACN,OAAO;;;;;;;;aAEP,MAAM,GAAG,MAAM;;;;;;;;;;;sBAOf,MAAM;;;UAKN,QAAQ,GAAG,MAAM,GAAG,WAAW;aAC/B,MAAM;;iCAvXa,sBAAsB"}
package/types/index.d.ts CHANGED
@@ -3,4 +3,6 @@ export { default as McpServer } from "./McpServer.js";
3
3
  import { AnthropicClient } from './anthropic.js';
4
4
  import { GoogleClient } from './google.js';
5
5
  import { OpenAiClient } from './openai.js';
6
+ import { XAiClient } from './xai.js';
7
+ export { AnthropicClient, GoogleClient, OpenAiClient, XAiClient };
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAMA,0FAkBC;;gCAxB+B,gBAAgB;6BACnB,aAAa;6BACb,aAAa"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAMA,0FAkBC;;gCAxB+B,gBAAgB;6BACnB,aAAa;6BACb,aAAa;0BAChB,UAAU"}