@memorilabs/axon 0.1.0 → 0.1.2-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/core/axon.d.ts +2 -16
- package/dist/core/axon.d.ts.map +1 -1
- package/dist/core/axon.js +2 -10
- package/dist/core/axon.js.map +1 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +0 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- 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/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -1
- package/dist/types/index.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 +1 -1
- package/dist/core/config.d.ts +0 -6
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js +0 -9
- package/dist/core/config.js.map +0 -1
- package/dist/types/config.d.ts +0 -23
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js +0 -2
- package/dist/types/config.js.map +0 -1
package/dist/core/axon.d.ts
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
import { AxonConfig } from '../types/config.js';
|
|
2
1
|
import { HookRegistry } from '../hooks/registry.js';
|
|
3
2
|
import { LLMRegistry } from '../llm/registry.js';
|
|
4
3
|
import { CallContext, LLMRequest, LLMResponse } from '../types/index.js';
|
|
5
|
-
/**
|
|
6
|
-
* Configuration options for initializing Axon.
|
|
7
|
-
*/
|
|
8
|
-
export interface AxonOpts {
|
|
9
|
-
/** Runtime configuration overrides. */
|
|
10
|
-
config?: AxonConfig;
|
|
11
|
-
}
|
|
12
4
|
/**
|
|
13
5
|
* The central hub for the Axon SDK.
|
|
14
6
|
*
|
|
15
7
|
* This class orchestrates the lifecycle of LLM calls, managing:
|
|
16
8
|
* - Provider registration (e.g., wrapping OpenAI).
|
|
17
9
|
* - Hook execution (before/after calls).
|
|
18
|
-
* - Configuration state.
|
|
19
|
-
*
|
|
20
10
|
* @example
|
|
21
11
|
* ```ts
|
|
22
12
|
* import { Axon } from 'axon';
|
|
23
13
|
* import { OpenAI } from 'openai';
|
|
24
14
|
*
|
|
25
|
-
* const axon = new Axon(
|
|
15
|
+
* const axon = new Axon();
|
|
26
16
|
* const client = new OpenAI();
|
|
27
17
|
*
|
|
28
18
|
* // 1. Register the client
|
|
@@ -39,8 +29,6 @@ export interface AxonOpts {
|
|
|
39
29
|
* ```
|
|
40
30
|
*/
|
|
41
31
|
export declare class Axon {
|
|
42
|
-
/** The active configuration for this instance. */
|
|
43
|
-
readonly config: Required<AxonConfig>;
|
|
44
32
|
/** Registry for managing third-party LLM providers. */
|
|
45
33
|
readonly llm: LLMRegistry;
|
|
46
34
|
/** Registry for hooks that run *before* the LLM call. */
|
|
@@ -49,10 +37,8 @@ export declare class Axon {
|
|
|
49
37
|
readonly after: HookRegistry<'after'>;
|
|
50
38
|
/**
|
|
51
39
|
* Creates a new Axon instance.
|
|
52
|
-
*
|
|
53
|
-
* @param opts - Initialization options, including configuration overrides.
|
|
54
40
|
*/
|
|
55
|
-
constructor(
|
|
41
|
+
constructor();
|
|
56
42
|
/**
|
|
57
43
|
* Executes the 'before' hook pipeline.
|
|
58
44
|
* @internal
|
package/dist/core/axon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axon.d.ts","sourceRoot":"","sources":["../../src/core/axon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"axon.d.ts","sourceRoot":"","sources":["../../src/core/axon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,IAAI;IACf,uDAAuD;IACvD,SAAgB,GAAG,EAAE,WAAW,CAAC;IACjC,yDAAyD;IACzD,SAAgB,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC/C,wDAAwD;IACxD,SAAgB,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAE7C;;OAEG;;IAOH;;;OAGG;IACG,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAI3E;;;OAGG;IACG,QAAQ,CACZ,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,WAAW,EACrB,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,WAAW,CAAC;CAGxB"}
|
package/dist/core/axon.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { defaultAxonConfig } from './config.js';
|
|
2
1
|
import { HookRegistry } from '../hooks/registry.js';
|
|
3
2
|
import { LLMRegistry } from '../llm/registry.js';
|
|
4
3
|
/**
|
|
@@ -7,14 +6,12 @@ import { LLMRegistry } from '../llm/registry.js';
|
|
|
7
6
|
* This class orchestrates the lifecycle of LLM calls, managing:
|
|
8
7
|
* - Provider registration (e.g., wrapping OpenAI).
|
|
9
8
|
* - Hook execution (before/after calls).
|
|
10
|
-
* - Configuration state.
|
|
11
|
-
*
|
|
12
9
|
* @example
|
|
13
10
|
* ```ts
|
|
14
11
|
* import { Axon } from 'axon';
|
|
15
12
|
* import { OpenAI } from 'openai';
|
|
16
13
|
*
|
|
17
|
-
* const axon = new Axon(
|
|
14
|
+
* const axon = new Axon();
|
|
18
15
|
* const client = new OpenAI();
|
|
19
16
|
*
|
|
20
17
|
* // 1. Register the client
|
|
@@ -31,8 +28,6 @@ import { LLMRegistry } from '../llm/registry.js';
|
|
|
31
28
|
* ```
|
|
32
29
|
*/
|
|
33
30
|
export class Axon {
|
|
34
|
-
/** The active configuration for this instance. */
|
|
35
|
-
config;
|
|
36
31
|
/** Registry for managing third-party LLM providers. */
|
|
37
32
|
llm;
|
|
38
33
|
/** Registry for hooks that run *before* the LLM call. */
|
|
@@ -41,11 +36,8 @@ export class Axon {
|
|
|
41
36
|
after;
|
|
42
37
|
/**
|
|
43
38
|
* Creates a new Axon instance.
|
|
44
|
-
*
|
|
45
|
-
* @param opts - Initialization options, including configuration overrides.
|
|
46
39
|
*/
|
|
47
|
-
constructor(
|
|
48
|
-
this.config = { ...defaultAxonConfig, ...(opts.config ?? {}) };
|
|
40
|
+
constructor() {
|
|
49
41
|
this.llm = new LLMRegistry(this);
|
|
50
42
|
this.before = new HookRegistry('before');
|
|
51
43
|
this.after = new HookRegistry('after');
|
package/dist/core/axon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axon.js","sourceRoot":"","sources":["../../src/core/axon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"axon.js","sourceRoot":"","sources":["../../src/core/axon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,OAAO,IAAI;IACf,uDAAuD;IACvC,GAAG,CAAc;IACjC,yDAAyD;IACzC,MAAM,CAAyB;IAC/C,wDAAwD;IACxC,KAAK,CAAwB;IAE7C;;OAEG;IACH;QACE,IAAI,CAAC,GAAG,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,SAAS,CAAC,OAAmB,EAAE,GAAgB;QACnD,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAe,CAAC;IACjE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ,CACZ,OAAmB,EACnB,QAAqB,EACrB,GAAgB;QAEhB,OAAO,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAgB,CAAC;IAC3E,CAAC;CACF"}
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/core/index.js
CHANGED
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAElC,OAAO,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAElC,OAAO,sBAAsB,CAAC"}
|
|
@@ -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.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K,qBAAqB,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,KAAK,YAAY,EAAE,CAAC;QAC/E,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC;IAC1B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAe,EAAE,IAAU;IAC9D,MAAM,SAAS,GAAG,MAAyB,CAAC;IAC5C,MAAM,UAAU,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAEhD,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,OAA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AAC,CAAC;IACnD,IAAI,UAAU,GAAG,KAAK,CAAC;IAEvB,6BAA6B;IAC7B,IAAI,YAAY,CAAC,SAAS,EAAE,CAAC;QAC3B,IACE,WAAW,CAAC;YACV,IAAI;YACJ,MAAM,EAAE,YAAY,CAAC,SAAS;YAC9B,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,UAAU,EAAE;YAC3E,aAAa,EAAE,sBAAsB;YACrC,aAAa,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"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
|
package/dist/types/index.js
CHANGED
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,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
package/dist/core/config.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,UAAU,CAIlD,CAAC"}
|
package/dist/core/config.js
DELETED
package/dist/core/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAyB;IACrD,QAAQ,EAAE,IAAI;IACd,kBAAkB,EAAE,KAAK;IACzB,kBAAkB,EAAE,KAAK;CAC1B,CAAC"}
|
package/dist/types/config.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration options for the Axon runtime.
|
|
3
|
-
*/
|
|
4
|
-
export interface AxonConfig {
|
|
5
|
-
/**
|
|
6
|
-
* If `true`, the process will throw an error immediately if a hook fails.
|
|
7
|
-
* If `false`, errors in hooks are logged but execution continues.
|
|
8
|
-
* @default true
|
|
9
|
-
*/
|
|
10
|
-
failFast?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* If `true`, 'after' hooks are executed asynchronously without blocking the return of the LLM response.
|
|
13
|
-
* Useful for logging/tracing without adding latency.
|
|
14
|
-
* @default false
|
|
15
|
-
*/
|
|
16
|
-
postCallBackground?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* If `true`, Axon collects duration metrics for every hook execution.
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
collectHookTimings?: boolean;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B"}
|
package/dist/types/config.js
DELETED
package/dist/types/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":""}
|