@memorilabs/axon 0.1.1-beta → 0.1.3-beta
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/dist/providers/anthropic/proxy.d.ts.map +1 -1
- package/dist/providers/anthropic/proxy.js +3 -1
- package/dist/providers/anthropic/proxy.js.map +1 -1
- package/dist/providers/openai/proxy.d.ts.map +1 -1
- package/dist/providers/openai/proxy.js +4 -2
- package/dist/providers/openai/proxy.js.map +1 -1
- package/dist/providers/telemetry.d.ts +16 -0
- package/dist/providers/telemetry.d.ts.map +1 -0
- package/dist/providers/telemetry.js +38 -0
- package/dist/providers/telemetry.js.map +1 -0
- package/dist/types/context.d.ts +9 -5
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/context.js +6 -2
- package/dist/types/context.js.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +15 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/providers/anthropic/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/providers/anthropic/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAiD/C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAmBtE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { anthropicInputToMessages, messagesToAnthropicInput, contentFromAnthropic, usageFromAnthropic, applyContentToResponse, } from './common.js';
|
|
2
2
|
import { patchMethod } from '../patcher.js';
|
|
3
|
+
import { extractSDKVersion } from '../telemetry.js';
|
|
3
4
|
function extractParams(args) {
|
|
4
5
|
// Separate model and messages from extra provider-specific parameters
|
|
5
6
|
const { model: _model, messages: _messages, ...params } = args;
|
|
@@ -39,6 +40,7 @@ function chunkToText(chunk) {
|
|
|
39
40
|
*/
|
|
40
41
|
export function patchAnthropicClient(client, axon) {
|
|
41
42
|
const antClient = client;
|
|
43
|
+
const sdkVersion = extractSDKVersion(antClient);
|
|
42
44
|
if (!antClient.messages) {
|
|
43
45
|
throw new Error('Anthropic client has no messages API.');
|
|
44
46
|
}
|
|
@@ -46,7 +48,7 @@ export function patchAnthropicClient(client, axon) {
|
|
|
46
48
|
axon,
|
|
47
49
|
parent: antClient.messages,
|
|
48
50
|
methodName: 'create',
|
|
49
|
-
ctxMetadata: { provider: 'anthropic', method: 'messages.create' },
|
|
51
|
+
ctxMetadata: { provider: 'anthropic', method: 'messages.create', sdkVersion },
|
|
50
52
|
argsToRequest,
|
|
51
53
|
requestToArgs,
|
|
52
54
|
rawToResponse: rawToCanonical,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/providers/anthropic/proxy.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/providers/anthropic/proxy.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,SAAS,aAAa,CAAC,IAAyB;IAC9C,sEAAsE;IACtE,MAAM,EAA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AEhD,IAAI,CAAE,SAAgD,CAAC,QAAQ,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,WAAW,CAAC;QACV,IAAI;QACJ,MAAM,EAAE,SAAS,CAAC,QAAQ;QAC1B,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE;QAC7E,aAAa;QACb,aAAa;QACb,aAAa,EAAE,cAAc;QAC7B,mBAAmB,EAAE,sBAAsB;QAC3C,WAAW;KACZ,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/providers/openai/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/providers/openai/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AA6E/C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CA6CnE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { openaiInputToMessages, messagesToOpenAIInput, contentFromOpenAI, usageFromOpenAI, applyContentToTextResponse, applyContentToChatResponse, } from './common.js';
|
|
2
2
|
import { isOpenAIClient } from './detect.js';
|
|
3
3
|
import { patchMethod } from '../patcher.js';
|
|
4
|
+
import { extractSDKVersion } from '../telemetry.js';
|
|
4
5
|
function extractParams(args, inputKey) {
|
|
5
6
|
const { model: _model, [inputKey]: _input, ...params } = args;
|
|
6
7
|
return params;
|
|
@@ -52,6 +53,7 @@ function chunkToText(chunk) {
|
|
|
52
53
|
}
|
|
53
54
|
export function patchOpenAIClient(client, axon) {
|
|
54
55
|
const openaiClient = client;
|
|
56
|
+
const sdkVersion = extractSDKVersion(openaiClient);
|
|
55
57
|
let patchedAny = false;
|
|
56
58
|
// Patch Legacy Responses API
|
|
57
59
|
if (openaiClient.responses) {
|
|
@@ -59,7 +61,7 @@ export function patchOpenAIClient(client, axon) {
|
|
|
59
61
|
axon,
|
|
60
62
|
parent: openaiClient.responses,
|
|
61
63
|
methodName: 'create',
|
|
62
|
-
ctxMetadata: { provider: 'openai', method: 'responses.create' },
|
|
64
|
+
ctxMetadata: { provider: 'openai', method: 'responses.create', sdkVersion },
|
|
63
65
|
argsToRequest: responsesArgsToRequest,
|
|
64
66
|
requestToArgs: requestToResponsesArgs,
|
|
65
67
|
rawToResponse: rawToCanonical,
|
|
@@ -74,7 +76,7 @@ export function patchOpenAIClient(client, axon) {
|
|
|
74
76
|
axon,
|
|
75
77
|
parent: openaiClient.chat.completions,
|
|
76
78
|
methodName: 'create',
|
|
77
|
-
ctxMetadata: { provider: 'openai', method: 'chat.completions.create' },
|
|
79
|
+
ctxMetadata: { provider: 'openai', method: 'chat.completions.create', sdkVersion },
|
|
78
80
|
argsToRequest: chatArgsToRequest,
|
|
79
81
|
requestToArgs: requestToChatArgs,
|
|
80
82
|
rawToResponse: rawToCanonical,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/providers/openai/proxy.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/providers/openai/proxy.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,qBAAqB,EACrB,qBAAq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a,EAAE,sBAAsB;YACrC,aAAa,EAAE,cAAc;YAC7B,mBAAmB,EAAE,0BAA0B;SAChD,CAAC,EACF,CAAC;YACD,UAAU,GAAG,IAAI,CAAC;QACpB,CAAC;IACH,CAAC;IAED,6BAA6B;IAC7B,IAAI,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC;QACnC,IACE,WAAW,CAAC;YACV,IAAI;YACJ,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,WAAW;YACrC,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,yBAAyB,EAAE,UAAU,EAAE;YAClF,aAAa,EAAE,iBAAiB;YAChC,aAAa,EAAE,iBAAiB;YAChC,aAAa,EAAE,cAAc;YAC7B,mBAAmB,EAAE,0BAA0B;YAC/C,WAAW;SACZ,CAAC,EACF,CAAC;YACD,UAAU,GAAG,IAAI,CAAC;QACpB,CAAC;IACH,CAAC;IAED,IAAI,CAAC,UAAU,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the common internal structure of auto-generated LLM clients (like Stainless).
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export type VersionedClient = {
|
|
6
|
+
VERSION?: string;
|
|
7
|
+
version?: string;
|
|
8
|
+
getUserAgent?: () => string;
|
|
9
|
+
defaultHeaders?: (opts?: unknown) => Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Attempts to safely extract the SDK version from an LLM client instance.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function extractSDKVersion(client: unknown): string | null;
|
|
16
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/providers/telemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CA+BhE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attempts to safely extract the SDK version from an LLM client instance.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export function extractSDKVersion(client) {
|
|
6
|
+
const vClient = client;
|
|
7
|
+
// 1. Check for standard attached properties
|
|
8
|
+
if (typeof vClient.VERSION === 'string')
|
|
9
|
+
return vClient.VERSION;
|
|
10
|
+
if (typeof vClient.version === 'string')
|
|
11
|
+
return vClient.version;
|
|
12
|
+
// 2. Sniff the version from the internal User-Agent generator
|
|
13
|
+
if (typeof vClient.getUserAgent === 'function') {
|
|
14
|
+
try {
|
|
15
|
+
const ua = vClient.getUserAgent(); // e.g., "OpenAI/JS 4.28.0"
|
|
16
|
+
const match = ua.match(/([0-9]+\.[0-9]+\.[0-9]+(?:-[a-zA-Z0-9.]+)?)/);
|
|
17
|
+
if (match)
|
|
18
|
+
return match[1];
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// ignore, commenting for lint
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// 3. Sniff the version from the default headers payload
|
|
25
|
+
if (typeof vClient.defaultHeaders === 'function') {
|
|
26
|
+
try {
|
|
27
|
+
const headers = vClient.defaultHeaders({});
|
|
28
|
+
if (headers['x-stainless-package-version']) {
|
|
29
|
+
return headers['x-stainless-package-version'];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// ignore, commenting for lint
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/providers/telemetry.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC/C,MAAM,OAAO,GAAG,MAAyB,CAAC;IAE1C,4CAA4C;IAC5C,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC;IAChE,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC;IAEhE,8DAA8D;IAC9D,IAAI,OAAO,OAAO,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;QAC/C,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,2BAA2B;YAC9D,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;YACtE,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,8BAA8B;QAChC,CAAC;IACH,CAAC;IAED,wDAAwD;IACxD,IAAI,OAAO,OAAO,CAAC,cAAc,KAAK,UAAU,EAAE,CAAC;QACjD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;YAC3C,IAAI,OAAO,CAAC,6BAA6B,CAAC,EAAE,CAAC;gBAC3C,OAAO,OAAO,CAAC,6BAA6B,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,8BAA8B;QAChC,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/types/context.d.ts
CHANGED
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
* Context data that persists throughout the lifecycle of a single LLM call.
|
|
3
3
|
*/
|
|
4
4
|
export interface CallContext {
|
|
5
|
-
/** A unique identifier for this specific call execution. */
|
|
6
5
|
traceId: string;
|
|
7
|
-
/** The timestamp when the call started. */
|
|
8
6
|
startedAt: Date;
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
metadata: {
|
|
8
|
+
platform?: string | null;
|
|
9
|
+
framework?: string | null;
|
|
10
|
+
provider?: string | null;
|
|
11
|
+
method?: string | null;
|
|
12
|
+
sdkVersion?: string | null;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
11
15
|
}
|
|
12
16
|
/**
|
|
13
|
-
* Creates a default call context
|
|
17
|
+
* Creates a default call context
|
|
14
18
|
* @internal
|
|
15
19
|
*/
|
|
16
20
|
export declare function createCallContext(init?: Partial<CallContext>): CallContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAU1E"}
|
package/dist/types/context.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
/**
|
|
3
|
-
* Creates a default call context
|
|
3
|
+
* Creates a default call context
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
6
|
export function createCallContext(init) {
|
|
7
7
|
return {
|
|
8
8
|
traceId: init?.traceId ?? randomUUID(),
|
|
9
9
|
startedAt: init?.startedAt ?? new Date(),
|
|
10
|
-
metadata:
|
|
10
|
+
metadata: {
|
|
11
|
+
platform: null,
|
|
12
|
+
framework: null,
|
|
13
|
+
...init?.metadata,
|
|
14
|
+
},
|
|
11
15
|
};
|
|
12
16
|
}
|
|
13
17
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAkBzC;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAA2B;IAC3D,OAAO;QACL,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,UAAU,EAAE;QACtC,SAAS,EAAE,IAAI,EAAE,SAAS,IAAI,IAAI,IAAI,EAAE;QACxC,QAAQ,EAAE;YACR,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI;YACf,GAAG,IAAI,EAAE,QAAQ;SAClB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,eAAe,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memorilabs/axon",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3-beta",
|
|
4
4
|
"description": "TypeScript SDK for Memori's hosted memory service",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -8,23 +8,28 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js"
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
12
13
|
},
|
|
13
14
|
"./openai": {
|
|
14
15
|
"types": "./dist/providers/openai/index.d.ts",
|
|
15
|
-
"import": "./dist/providers/openai/index.js"
|
|
16
|
+
"import": "./dist/providers/openai/index.js",
|
|
17
|
+
"default": "./dist/providers/openai/index.js"
|
|
16
18
|
},
|
|
17
19
|
"./anthropic": {
|
|
18
20
|
"types": "./dist/providers/anthropic/index.d.ts",
|
|
19
|
-
"import": "./dist/providers/anthropic/index.js"
|
|
21
|
+
"import": "./dist/providers/anthropic/index.js",
|
|
22
|
+
"default": "./dist/providers/anthropic/index.js"
|
|
20
23
|
},
|
|
21
24
|
"./types": {
|
|
22
25
|
"types": "./dist/types/index.d.ts",
|
|
23
|
-
"import": "./dist/types/index.js"
|
|
26
|
+
"import": "./dist/types/index.js",
|
|
27
|
+
"default": "./dist/types/index.js"
|
|
24
28
|
},
|
|
25
29
|
"./errors": {
|
|
26
30
|
"types": "./dist/errors/index.d.ts",
|
|
27
|
-
"import": "./dist/errors/index.js"
|
|
31
|
+
"import": "./dist/errors/index.js",
|
|
32
|
+
"default": "./dist/errors/index.js"
|
|
28
33
|
},
|
|
29
34
|
"./package.json": "./package.json"
|
|
30
35
|
},
|
|
@@ -74,8 +79,8 @@
|
|
|
74
79
|
},
|
|
75
80
|
"homepage": "https://github.com/MemoriLabs/axon",
|
|
76
81
|
"peerDependencies": {
|
|
77
|
-
"@anthropic-ai/sdk": "
|
|
78
|
-
"openai": "
|
|
82
|
+
"@anthropic-ai/sdk": "*",
|
|
83
|
+
"openai": "*"
|
|
79
84
|
},
|
|
80
85
|
"peerDependenciesMeta": {
|
|
81
86
|
"openai": {
|
|
@@ -86,7 +91,7 @@
|
|
|
86
91
|
}
|
|
87
92
|
},
|
|
88
93
|
"devDependencies": {
|
|
89
|
-
"@anthropic-ai/sdk": "
|
|
94
|
+
"@anthropic-ai/sdk": "*",
|
|
90
95
|
"@eslint/js": "^9.0.0",
|
|
91
96
|
"@types/node": "^20.11.30",
|
|
92
97
|
"@vitest/coverage-v8": "^2.1.9",
|
|
@@ -95,7 +100,7 @@
|
|
|
95
100
|
"eslint": "^9.0.0",
|
|
96
101
|
"eslint-config-prettier": "^10.1.8",
|
|
97
102
|
"lint-staged": "^15.0.0",
|
|
98
|
-
"openai": "
|
|
103
|
+
"openai": "*",
|
|
99
104
|
"prettier": "^3.0.0",
|
|
100
105
|
"typescript": "^5.7.3",
|
|
101
106
|
"typescript-eslint": "^8.55.0",
|