@puku-ai/sdk 3.0.1 → 3.0.2

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/sdk.d.ts CHANGED
@@ -97,7 +97,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
97
97
  /**
98
98
  * Base class for Anthropic API clients.
99
99
  */
100
- declare class BaseAnthropic {
100
+ declare class BasePuku {
101
101
  #private;
102
102
  apiKey: string | null;
103
103
  baseURL: string;
@@ -179,12 +179,13 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
179
179
  private buildHeaders;
180
180
  private _makeAbort;
181
181
  private buildBody;
182
- static Anthropic: typeof BaseAnthropic;
183
- static PukuAI: typeof BaseAnthropic;
182
+ static Anthropic: typeof BasePuku;
183
+ static PukuAI: typeof BasePuku;
184
184
  static HUMAN_PROMPT: string;
185
185
  static AI_PROMPT: string;
186
186
  static DEFAULT_TIMEOUT: number;
187
187
  static AnthropicError: typeof Errors.AnthropicError;
188
+ static PukuError: typeof Errors.PukuError;
188
189
  static APIError: typeof Errors.APIError;
189
190
  static APIConnectionError: typeof Errors.APIConnectionError;
190
191
  static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
@@ -208,7 +209,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
208
209
  * `import PukuAI from "@puku-ai/sdk"`. `Anthropic` is kept as a static
209
210
  * property pointing to the same class for source-compat.
210
211
  */
211
- declare class PukuAI extends BaseAnthropic {
212
+ declare class PukuAI extends BasePuku {
212
213
  completions: API.Completions;
213
214
  messages: API.Messages;
214
215
  models: API.Models;
@@ -224,7 +225,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
224
225
  private responsePromise;
225
226
  private parseResponse;
226
227
  private parsedPromise;
227
- constructor(client: BaseAnthropic, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: BaseAnthropic, props: APIResponseProps) => PromiseOrValue<WithRequestID<T>>);
228
+ constructor(client: BasePuku, responsePromise: Promise<APIResponseProps>, parseResponse?: (client: BasePuku, props: APIResponseProps) => PromiseOrValue<WithRequestID<T>>);
228
229
  _thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
229
230
  /**
230
231
  * Gets the raw `Response` instance instead of parsing the response
@@ -261,10 +262,32 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
261
262
  finally(onfinally?: (() => void) | undefined | null): Promise<WithRequestID<T>>;
262
263
  }
263
264
 
265
+ /**
266
+ * Legacy base error class, kept for backward compatibility with code
267
+ * imported from the Anthropic SDK. `PukuError` (the new branded base)
268
+ * extends this so `instanceof AnthropicError` continues to work for
269
+ * every error the SDK throws.
270
+ *
271
+ * @deprecated Import `PukuError` instead. Will be removed in the next
272
+ * major version.
273
+ */
264
274
  declare class AnthropicError extends Error {
265
275
  }
266
276
 
267
- declare class APIError<TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined> extends AnthropicError {
277
+ /**
278
+ * Branded base error class for the Puku SDK. Every error the SDK throws
279
+ * is an instance of `PukuError`, so `err.toString()` and stack traces
280
+ * surface as `PukuError: …`.
281
+ *
282
+ * We set `PukuError.prototype.name = 'PukuError'` so that
283
+ * `Error.prototype.toString()` (which reads `.name`) produces
284
+ * `PukuError: …` instead of the default `Error: …`.
285
+ */
286
+ declare class PukuError extends AnthropicError {
287
+ constructor(message?: string);
288
+ }
289
+
290
+ declare class APIError<TStatus extends number | undefined = number | undefined, THeaders extends Headers | undefined = Headers | undefined, TError extends Object | undefined = Object | undefined> extends PukuError {
268
291
  /** HTTP status for the response that caused the error */
269
292
  readonly status: TStatus;
270
293
  /** HTTP headers for the response that caused the error */
@@ -329,7 +352,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
329
352
  protected options: FinalRequestOptions;
330
353
  protected response: Response;
331
354
  protected body: unknown;
332
- constructor(client: BaseAnthropic, response: Response, body: unknown, options: FinalRequestOptions);
355
+ constructor(client: BasePuku, response: Response, body: unknown, options: FinalRequestOptions);
333
356
  abstract nextPageRequestOptions(): PageRequestOptions | null;
334
357
  abstract getPaginatedItems(): Item[];
335
358
  hasNextPage(): boolean;
@@ -348,7 +371,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
348
371
  * }
349
372
  */
350
373
  declare class PagePromise<PageClass extends AbstractPage<Item>, Item = ReturnType<PageClass['getPaginatedItems']>[number]> extends APIPromise<PageClass> implements AsyncIterable<Item> {
351
- constructor(client: BaseAnthropic, request: Promise<APIResponseProps>, Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass);
374
+ constructor(client: BasePuku, request: Promise<APIResponseProps>, Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass);
352
375
  /**
353
376
  * Allow auto-paginating iteration on an unawaited list call, eg:
354
377
  *
@@ -380,7 +403,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
380
403
  has_more: boolean;
381
404
  first_id: string | null;
382
405
  last_id: string | null;
383
- constructor(client: BaseAnthropic, response: Response, body: PageResponse<Item>, options: FinalRequestOptions);
406
+ constructor(client: BasePuku, response: Response, body: PageResponse<Item>, options: FinalRequestOptions);
384
407
  getPaginatedItems(): Item[];
385
408
  hasNextPage(): boolean;
386
409
  nextPageRequestOptions(): PageRequestOptions | null;
@@ -404,7 +427,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
404
427
  data: Array<Item>;
405
428
  has_more: boolean;
406
429
  next_page: string | null;
407
- constructor(client: BaseAnthropic, response: Response, body: TokenPageResponse<Item>, options: FinalRequestOptions);
430
+ constructor(client: BasePuku, response: Response, body: TokenPageResponse<Item>, options: FinalRequestOptions);
408
431
  getPaginatedItems(): Item[];
409
432
  hasNextPage(): boolean;
410
433
  nextPageRequestOptions(): PageRequestOptions | null;
@@ -428,15 +451,15 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
428
451
  data: Array<Item>;
429
452
  has_more: boolean;
430
453
  next_page: string | null;
431
- constructor(client: BaseAnthropic, response: Response, body: PageCursorResponse<Item>, options: FinalRequestOptions);
454
+ constructor(client: BasePuku, response: Response, body: PageCursorResponse<Item>, options: FinalRequestOptions);
432
455
  getPaginatedItems(): Item[];
433
456
  hasNextPage(): boolean;
434
457
  nextPageRequestOptions(): PageRequestOptions | null;
435
458
  }
436
459
 
437
460
  declare abstract class APIResource {
438
- protected _client: BaseAnthropic;
439
- constructor(client: BaseAnthropic);
461
+ protected _client: BasePuku;
462
+ constructor(client: BasePuku);
440
463
  }
441
464
 
442
465
  type ServerSentEvent = {
@@ -449,13 +472,13 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
449
472
  #private;
450
473
  private iterator;
451
474
  controller: AbortController;
452
- constructor(iterator: () => AsyncIterator<Item>, controller: AbortController, client?: BaseAnthropic);
453
- static fromSSEResponse<Item>(response: Response, controller: AbortController, client?: BaseAnthropic): Stream<Item>;
475
+ constructor(iterator: () => AsyncIterator<Item>, controller: AbortController, client?: BasePuku);
476
+ static fromSSEResponse<Item>(response: Response, controller: AbortController, client?: BasePuku): Stream<Item>;
454
477
  /**
455
478
  * Generates a Stream from a newline-separated ReadableStream
456
479
  * where each item is a JSON value.
457
480
  */
458
- static fromReadableStream<Item>(readableStream: ReadableStream, controller: AbortController, client?: BaseAnthropic): Stream<Item>;
481
+ static fromReadableStream<Item>(readableStream: ReadableStream, controller: AbortController, client?: BasePuku): Stream<Item>;
459
482
  [Symbol.asyncIterator](): AsyncIterator<Item>;
460
483
  /**
461
484
  * Splits the stream into two streams which can be
@@ -983,7 +1006,7 @@ declare const brand_privateNullableHeaders: symbol & {
983
1006
  startTime: number;
984
1007
  };
985
1008
 
986
- declare function defaultParseResponse<T>(client: BaseAnthropic, props: APIResponseProps): Promise<WithRequestID<T>>;
1009
+ declare function defaultParseResponse<T>(client: BasePuku, props: APIResponseProps): Promise<WithRequestID<T>>;
987
1010
 
988
1011
  type WithRequestID<T> = T extends Array<any> | Response | AbstractPage<any> ? T : T extends Record<string, any> ? T & {
989
1012
  _request_id?: string | null;
@@ -1253,15 +1276,15 @@ interface BunFile extends Blob {
1253
1276
  * Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
1254
1277
  * Otherwise returns the request as is.
1255
1278
  */
1256
- declare const maybeMultipartFormRequestOptions: (opts: RequestOptions, fetch: BaseAnthropic | Fetch) => Promise<RequestOptions>;
1279
+ declare const maybeMultipartFormRequestOptions: (opts: RequestOptions, fetch: BasePuku | Fetch) => Promise<RequestOptions>;
1257
1280
 
1258
1281
  type MultipartFormRequestOptions = Omit<RequestOptions, 'body'> & {
1259
1282
  body: unknown;
1260
1283
  };
1261
1284
 
1262
- declare const multipartFormRequestOptions: (opts: MultipartFormRequestOptions, fetch: BaseAnthropic | Fetch, stripFilenames?: boolean) => Promise<RequestOptions>;
1285
+ declare const multipartFormRequestOptions: (opts: MultipartFormRequestOptions, fetch: BasePuku | Fetch, stripFilenames?: boolean) => Promise<RequestOptions>;
1263
1286
 
1264
- declare const createForm: <T = Record<string, unknown>>(body: T | undefined, fetch: BaseAnthropic | Fetch, stripFilenames?: boolean) => Promise<FormData>;
1287
+ declare const createForm: <T = Record<string, unknown>>(body: T | undefined, fetch: BasePuku | Fetch, stripFilenames?: boolean) => Promise<FormData>;
1265
1288
 
1266
1289
  type LogFn = (message: string, ...rest: unknown[]) => void;
1267
1290
 
@@ -1274,9 +1297,9 @@ type LogFn = (message: string, ...rest: unknown[]) => void;
1274
1297
 
1275
1298
  type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
1276
1299
 
1277
- declare const parseLogLevel: (maybeLevel: string | undefined, sourceName: string, client: BaseAnthropic) => LogLevel | undefined;
1300
+ declare const parseLogLevel: (maybeLevel: string | undefined, sourceName: string, client: BasePuku) => LogLevel | undefined;
1278
1301
 
1279
- declare function loggerFor(client: BaseAnthropic): Logger;
1302
+ declare function loggerFor(client: BasePuku): Logger;
1280
1303
 
1281
1304
  declare const formatRequestDetails: (details: {
1282
1305
  options?: RequestOptions | undefined;
@@ -8787,16 +8810,16 @@ type StainlessHelperObject = {
8787
8810
  declare function readHead(file: string, n: number): Promise<Buffer>;
8788
8811
  declare const VERSION = "0.81.0";
8789
8812
 
8790
- export { default, VERSION, betaTool, betaJSONSchemaOutputFormat, betaZodTool, betaZodOutputFormat, InputSchema, betaMemoryTool };
8813
+ export { default, VERSION, PukuError, betaTool, betaJSONSchemaOutputFormat, betaZodTool, betaZodOutputFormat, InputSchema };
8791
8814
 
8792
- export { MemoryToolHandlers, mcpTool, mcpTools, mcpMessage, mcpMessages, mcpContent, mcpResourceToContent, mcpResourceToFile };
8815
+ export { betaMemoryTool, MemoryToolHandlers, mcpTool, mcpTools, mcpMessage, mcpMessages, mcpContent, mcpResourceToContent };
8793
8816
 
8794
- export { UnsupportedMCPValueError, MCPToolLike, MCPCallToolResultLike, MCPToolResultContentLike, MCPTextContentLike, MCPImageContentLike, MCPAudioContentLike, MCPEmbeddedResourceLike };
8817
+ export { mcpResourceToFile, UnsupportedMCPValueError, MCPToolLike, MCPCallToolResultLike, MCPToolResultContentLike, MCPTextContentLike, MCPImageContentLike, MCPAudioContentLike };
8795
8818
 
8796
- export { MCPResourceLinkLike, MCPTextResourceContentsLike, MCPBlobResourceContentsLike, MCPResourceContentsLike, MCPClientLike, MCPPromptMessageLike, MCPPromptContentLike, MCPReadResourceResultLike };
8819
+ export { MCPEmbeddedResourceLike, MCPResourceLinkLike, MCPTextResourceContentsLike, MCPBlobResourceContentsLike, MCPResourceContentsLike, MCPClientLike, MCPPromptMessageLike, MCPPromptContentLike };
8797
8820
 
8798
- export { ToolError, Promisable, BetaToolRunContext, BetaClientRunnableToolType, betaAgentToolset20260401, betaBashTool, betaReadTool, betaWriteTool };
8821
+ export { MCPReadResourceResultLike, ToolError, Promisable, BetaToolRunContext, BetaClientRunnableToolType, betaAgentToolset20260401, betaBashTool, betaReadTool };
8799
8822
 
8800
- export { betaEditTool, betaGlobTool, betaGrepTool, resolvePath, BashSession, BashTimeoutError, setupSkills, resolveSkillVersion };
8823
+ export { betaWriteTool, betaEditTool, betaGlobTool, betaGrepTool, resolvePath, BashSession, BashTimeoutError, setupSkills };
8801
8824
 
8802
- export { extractSkillArchive, AgentToolContext };
8825
+ export { resolveSkillVersion, extractSkillArchive, AgentToolContext };