@l10nmonster/helpers-anthropic 3.0.0-alpha.1 → 3.0.0-alpha.11

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.
@@ -0,0 +1,31 @@
1
+ {
2
+ "branches": [
3
+ "main",
4
+ {
5
+ "name": "next",
6
+ "prerelease": "alpha"
7
+ },
8
+ {
9
+ "name": "beta",
10
+ "prerelease": "beta"
11
+ }
12
+ ],
13
+ "tagFormat": "@l10nmonster/helpers-anthropic@${version}",
14
+ "plugins": [
15
+ "@semantic-release/commit-analyzer",
16
+ "@semantic-release/release-notes-generator",
17
+ {
18
+ "path": "@semantic-release/changelog",
19
+ "changelogFile": "CHANGELOG.md"
20
+ },
21
+ {
22
+ "path": "@semantic-release/npm",
23
+ "npmPublish": true
24
+ },
25
+ {
26
+ "path": "@semantic-release/git",
27
+ "assets": ["CHANGELOG.md", "package.json"],
28
+ "message": "chore(release): @l10nmonster/helpers-anthropic@${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
29
+ }
30
+ ]
31
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
package/README.md CHANGED
@@ -97,7 +97,7 @@ The test suite includes:
97
97
 
98
98
  ## Requirements
99
99
 
100
- - Node.js >= 18.0.0
100
+ - Node.js >= 22.11.0
101
101
  - Google Cloud Project with Vertex AI API enabled
102
102
  - Proper authentication setup for Google Cloud
103
103
 
package/anthropicAgent.js CHANGED
@@ -2,7 +2,7 @@ import { AnthropicVertex } from '@anthropic-ai/vertex-sdk';
2
2
  import Anthropic from '@anthropic-ai/sdk';
3
3
  import { GoogleAuth } from 'google-auth-library';
4
4
 
5
- import { logInfo, logVerbose, logWarn, providers, styleString } from '../core/index.js';
5
+ import { logInfo, logWarn, providers, styleString } from '../core/index.js';
6
6
 
7
7
  const TRANSLATION_TOOL = {
8
8
  name: 'provide_translations',
@@ -30,7 +30,7 @@ const TRANSLATION_TOOL = {
30
30
  /**
31
31
  * @typedef {object} AnthropicAgentOptions
32
32
  * @extends LLMTranslationProviderOptions
33
- * @property {string} [apiKey] - The Anthropic API key (if using direct API).
33
+ * @property {Promise<string>|string} [apiKey] - The Anthropic API key (if using direct API).
34
34
  * @property {string} [vertexProject] - The VertexAI project ID.
35
35
  * @property {string} [vertexLocation] - The VertexAI datacenter location.
36
36
  * @property {number} [maxTokens] - Maximum number of output tokens (32000 by default)
@@ -69,7 +69,7 @@ export class AnthropicAgent extends providers.LLMTranslationProvider {
69
69
  if (this.#apiKey) {
70
70
  // Direct Anthropic API
71
71
  this.#client = new Anthropic({
72
- apiKey: this.#apiKey,
72
+ apiKey: await (typeof this.#apiKey === 'function' ? this.#apiKey() : this.#apiKey),
73
73
  maxRetries: this.#maxRetries,
74
74
  timeout: 15 * 60000, // 15 minutes
75
75
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@l10nmonster/helpers-anthropic",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.11",
4
4
  "description": "Anthropic Claude LLM provider for l10nmonster using Vertex AI",
5
5
  "type": "module",
6
6
  "main": "anthropicAgent.js",
@@ -13,10 +13,10 @@
13
13
  "google-auth-library": "^10"
14
14
  },
15
15
  "peerDependencies": {
16
- "@l10nmonster/core": "file:../core"
16
+ "@l10nmonster/core": "^3.0.0-alpha.0"
17
17
  },
18
18
  "engines": {
19
- "node": ">=18.0.0"
19
+ "node": ">=22.11.0"
20
20
  },
21
21
  "license": "MIT"
22
22
  }