diff --git a/sdks/node/scripts/loadTest.ts b/sdks/node/scripts/loadTest.ts index 2850b83b2322..0d183adddd6d 100644 --- a/sdks/node/scripts/loadTest.ts +++ b/sdks/node/scripts/loadTest.ts @@ -1,4 +1,5 @@ import * as weave from 'weave'; +import type {WeaveClient} from 'weave'; const func = weave.op(async () => 1); const myFunction = async (a: number = 1, b: string = 'hello', c: boolean = true) => { @@ -13,7 +14,7 @@ const myFunction2 = async ({ a, b = 'wuh' }: { a?: number; b?: string }) => { }; const func4 = weave.op(myFunction2, { parameterNames: 'useParam0Object' }); -async function bench(func: weave.Op, calls: number, client: weave.WeaveClient) { +async function bench(func: weave.Op, calls: number, client: WeaveClient) { console.log(`Benchmarking with ${calls} calls...`); const startTime = Date.now(); const promises = Array(calls) diff --git a/sdks/node/src/__tests__/call.manipulation.test.ts b/sdks/node/src/__tests__/call.manipulation.test.ts index 03b32a8945fa..a81d6b383991 100644 --- a/sdks/node/src/__tests__/call.manipulation.test.ts +++ b/sdks/node/src/__tests__/call.manipulation.test.ts @@ -1,4 +1,4 @@ -import * as weave from 'weave'; +import {WeaveClient} from '../weaveClient'; import {op, Op} from 'weave'; import {CallState, InternalCall} from 'weave/call'; import {getGlobalClient} from 'weave/clientApi'; @@ -10,7 +10,7 @@ const mockUpdateCall = jest.fn(); jest.mock('weave/clientApi', () => ({ getGlobalClient: jest.fn(() => { - const weaveClient = new weave.WeaveClient( + const weaveClient = new WeaveClient( null as any, null as any, mockProjectId diff --git a/sdks/node/src/__tests__/call.test.ts b/sdks/node/src/__tests__/call.test.ts index e67553b59787..57eba135b25c 100644 --- a/sdks/node/src/__tests__/call.test.ts +++ b/sdks/node/src/__tests__/call.test.ts @@ -1,5 +1,6 @@ import * as weave from 'weave'; import {op, type Op} from 'weave'; +import {WeaveClient} from '../weaveClient'; const mockOpName = 'weave://test-project-id/op/test-op'; const mockCallId = 'test-call-id'; @@ -7,7 +8,7 @@ const mockProjectId = 'test-project-id'; jest.mock('weave/clientApi', () => ({ getGlobalClient: jest.fn(() => { - const weaveClient = new weave.WeaveClient( + const weaveClient = new WeaveClient( null as any, null as any, mockProjectId @@ -22,7 +23,7 @@ jest.mock('weave/clientApi', () => ({ newStack: [], }), createCall: (...args: any) => { - return weave.WeaveClient.prototype.createCall.apply(weaveClient, args); + return WeaveClient.prototype.createCall.apply(weaveClient, args); }, startCall: (...args: any[]) => { return Promise.resolve(); diff --git a/sdks/node/src/index.ts b/sdks/node/src/index.ts index 960aa0eb5676..5a698befaebd 100644 --- a/sdks/node/src/index.ts +++ b/sdks/node/src/index.ts @@ -66,9 +66,16 @@ export { type WeaveImage, } from './media'; export {op} from './op'; -export * from './types'; +export type {Op, OpDecorator} from './opType'; +/** + * @deprecated Create clients via `weave.init()` — direct construction is + * not part of the supported public API and the runtime export will be + * removed in a future release. + */ +export {WeaveClient} from "./weaveClient"; export {WeaveObject, ObjectRef} from './weaveObject'; export {MessagesPrompt, StringPrompt} from './prompt'; + // CJS-only side-effect: install the `require()` patcher so CJS hosts // auto-instrument supported modules. ESM hosts use the loader hook in // `./esm/instrument.mjs` instead, registered via `--import=weave/instrument`. diff --git a/sdks/node/src/types.ts b/sdks/node/src/types.ts deleted file mode 100644 index 635df30d29ed..000000000000 --- a/sdks/node/src/types.ts +++ /dev/null @@ -1,2 +0,0 @@ -export type {Op, OpDecorator} from './opType'; -export {WeaveClient} from './weaveClient'; diff --git a/sdks/node/src/weaveClient.ts b/sdks/node/src/weaveClient.ts index cbe169c3c783..d17a488e9fa8 100644 --- a/sdks/node/src/weaveClient.ts +++ b/sdks/node/src/weaveClient.ts @@ -187,6 +187,11 @@ export class WeaveClient { private errorCount = 0; private readonly MAX_ERRORS = 10; + /** + * @deprecated Create clients via `weave.init()` — direct construction is + * not part of the supported public API and the runtime export will be + * removed in a future release. + */ constructor( public traceServerApi: TraceServerApi, private wandbServerApi: WandbServerApi,