@aeye/anthropic 0.0.0-stage → 0.11.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.
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Errors the Anthropic provider throws.
3
+ */
4
+ /**
5
+ * The text of a provider error: what failed, then what the cause says. A
6
+ * cause with no message of its own (an HTTP error with an empty body) still
7
+ * gives its status, so the error is never just the provider's name.
8
+ */
9
+ export declare function providerErrorText(message: string, cause?: Error): string;
10
+ /**
11
+ * Base error for the Anthropic provider, with the underlying error as its
12
+ * cause.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * throw new ProviderError('anthropic', 'Invalid model specified', originalError);
17
+ * ```
18
+ */
19
+ export declare class ProviderError extends Error {
20
+ provider: string;
21
+ cause?: Error | undefined;
22
+ constructor(provider: string, message: string, cause?: Error | undefined);
23
+ }
24
+ /**
25
+ * The API key was rejected (401) or lacks permission (403).
26
+ */
27
+ export declare class ProviderAuthError extends ProviderError {
28
+ constructor(provider: string, cause?: Error);
29
+ }
30
+ /**
31
+ * Rate limited (429) or overloaded (529) after every retry, with the wait
32
+ * the API asked for when it said.
33
+ */
34
+ export declare class RateLimitError extends ProviderError {
35
+ retryAfter?: number | undefined;
36
+ constructor(provider: string, message: string, retryAfter?: number | undefined, cause?: Error);
37
+ }
38
+ /**
39
+ * A spend limit was reached (a 429 that waiting doesn't fix).
40
+ */
41
+ export declare class ProviderQuotaError extends ProviderError {
42
+ constructor(provider: string, cause?: Error);
43
+ }
44
+ /**
45
+ * The prompt is longer than the model's context window.
46
+ */
47
+ export declare class ContextWindowError extends ProviderError {
48
+ contextWindow?: number | undefined;
49
+ constructor(provider: string, message: string, contextWindow?: number | undefined, cause?: Error);
50
+ }
51
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAQxE;AAED;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,KAAK;IAG7B,QAAQ,EAAE,MAAM;IAGhB,KAAK,CAAC,EAAE,KAAK;gBAHb,QAAQ,EAAE,MAAM,EACvB,OAAO,EAAE,MAAM,EAER,KAAK,CAAC,EAAE,KAAK,YAAA;CAKvB;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,aAAa;gBACtC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAI5C;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAKtC,UAAU,CAAC,EAAE,MAAM;gBAH1B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EAER,UAAU,CAAC,EAAE,MAAM,YAAA,EAC1B,KAAK,CAAC,EAAE,KAAK;CAKhB;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;gBACvC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAI5C;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;IAK1C,aAAa,CAAC,EAAE,MAAM;gBAH7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EAER,aAAa,CAAC,EAAE,MAAM,YAAA,EAC7B,KAAK,CAAC,EAAE,KAAK;CAKhB"}
package/dist/types.js ADDED
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Errors the Anthropic provider throws.
3
+ */
4
+ /**
5
+ * The text of a provider error: what failed, then what the cause says. A
6
+ * cause with no message of its own (an HTTP error with an empty body) still
7
+ * gives its status, so the error is never just the provider's name.
8
+ */
9
+ export function providerErrorText(message, cause) {
10
+ const what = message.trim();
11
+ const detail = cause?.message?.trim();
12
+ const status = cause?.status;
13
+ const parts = [what || (detail ? '' : 'Request failed')].filter(Boolean);
14
+ if (detail && !what.includes(detail))
15
+ parts.push(detail);
16
+ else if (!detail && typeof status === 'number' && !what.includes(String(status)))
17
+ parts.push(`HTTP ${status} with no error message`);
18
+ return parts.join(': ');
19
+ }
20
+ /**
21
+ * Base error for the Anthropic provider, with the underlying error as its
22
+ * cause.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * throw new ProviderError('anthropic', 'Invalid model specified', originalError);
27
+ * ```
28
+ */
29
+ export class ProviderError extends Error {
30
+ provider;
31
+ cause;
32
+ constructor(
33
+ // The provider identifier
34
+ provider, message,
35
+ // Original error that caused this provider error
36
+ cause) {
37
+ super(`[${provider}] ${providerErrorText(message, cause)}`);
38
+ this.provider = provider;
39
+ this.cause = cause;
40
+ this.name = 'ProviderError';
41
+ }
42
+ }
43
+ /**
44
+ * The API key was rejected (401) or lacks permission (403).
45
+ */
46
+ export class ProviderAuthError extends ProviderError {
47
+ constructor(provider, cause) {
48
+ super(provider, 'Authentication failed', cause);
49
+ this.name = 'ProviderAuthError';
50
+ }
51
+ }
52
+ /**
53
+ * Rate limited (429) or overloaded (529) after every retry, with the wait
54
+ * the API asked for when it said.
55
+ */
56
+ export class RateLimitError extends ProviderError {
57
+ retryAfter;
58
+ constructor(provider, message,
59
+ // Seconds to wait before retrying, from `retry-after`
60
+ retryAfter, cause) {
61
+ super(provider, message, cause);
62
+ this.retryAfter = retryAfter;
63
+ this.name = 'RateLimitError';
64
+ }
65
+ }
66
+ /**
67
+ * A spend limit was reached (a 429 that waiting doesn't fix).
68
+ */
69
+ export class ProviderQuotaError extends ProviderError {
70
+ constructor(provider, cause) {
71
+ super(provider, 'Spend limit reached', cause);
72
+ this.name = 'ProviderQuotaError';
73
+ }
74
+ }
75
+ /**
76
+ * The prompt is longer than the model's context window.
77
+ */
78
+ export class ContextWindowError extends ProviderError {
79
+ contextWindow;
80
+ constructor(provider, message,
81
+ // The context window in tokens, when the error says
82
+ contextWindow, cause) {
83
+ super(provider, message, cause);
84
+ this.contextWindow = contextWindow;
85
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AI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAClD,YAAY,QAAgB,EAAE,KAAa;QACzC,KAAK,CAAC,QAAQ,EAAE,uBAAuB,EAAE,KAAK,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,aAAa;IAKtC;IAJT,YACE,QAAgB,EAChB,OAAe;IACf,sDAAsD;IAC/C,UAAmB,EAC1B,KAAa;QAEb,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAHzB,eAAU,GAAV,UAAU,CAAS;QAI1B,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IACnD,YAAY,QAAgB,EAAE,KAAa;QACzC,KAAK,CAAC,QAAQ,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAC9C,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IAK1C;IAJT,YACE,QAAgB,EAChB,OAAe;IACf,oDAAoD;IAC7C,aAAsB,EAC7B,KAAa;QAEb,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAHzB,kBAAa,GAAb,aAAa,CAAS;QAI7B,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,72 @@
1
1
  {
2
2
  "name": "@aeye/anthropic",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.11.1",
4
+ "description": "@aeye Anthropic - Claude (Anthropic Messages API) integration for @aeye",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "test": "jest",
20
+ "test:unit": "jest --testPathIgnorePatterns=__integration__",
21
+ "test:integration": "jest --testPathPattern=__integration__",
22
+ "test:coverage": "jest --coverage --testPathIgnorePatterns=__integration__",
23
+ "test:watch": "jest --watch",
24
+ "clean": "rimraf dist tsconfig.tsbuildinfo",
25
+ "typecheck": "tsc --noEmit",
26
+ "live:matrix": "tsx scripts/live-matrix.ts && npm run live:measured",
27
+ "live:report": "tsx scripts/live-report.ts ../../docs/plans/anthropic-measured-2026-11.md",
28
+ "live:models": "tsx scripts/list-models.ts",
29
+ "live:measured": "npm run models:measured -w @aeye/models -- anthropic"
30
+ },
31
+ "keywords": [
32
+ "ai",
33
+ "anthropic",
34
+ "claude",
35
+ "typescript"
36
+ ],
37
+ "author": "ClickerMonkey",
38
+ "license": "GPL-3.0",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://github.com/ClickerMonkey/aeye.git",
42
+ "directory": "packages/anthropic"
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "README.md",
47
+ "LICENSE",
48
+ "aeye-*.md"
49
+ ],
50
+ "dependencies": {
51
+ "@aeye/ai": "^0.11.1",
52
+ "@aeye/core": "^0.11.1",
53
+ "@anthropic-ai/sdk": "^1.14.0"
54
+ },
55
+ "devDependencies": {
56
+ "@types/jest": "^30.0.0",
57
+ "@types/node": "^24.10.1",
58
+ "jest": "^30.2.0",
59
+ "ts-jest": "^29.4.5",
60
+ "typescript": "^5.9.3"
61
+ },
62
+ "publishConfig": {
63
+ "access": "public"
64
+ },
65
+ "engines": {
66
+ "node": ">=22.0.0"
67
+ },
68
+ "homepage": "https://github.com/ClickerMonkey/aeye#readme",
69
+ "bugs": {
70
+ "url": "https://github.com/ClickerMonkey/aeye/issues"
71
+ }
72
+ }