@neta-art/cohub 2.11.1 → 2.11.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/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ Cohub
2
+ Copyright 2026 Viscept Limited
3
+
4
+ This product includes software developed by Viscept Limited and contributors.
@@ -293,6 +293,8 @@ declare const createWorkRuntime: (transport?: WorkRuntimeTransport, workId?: str
293
293
  type Fetch = typeof globalThis.fetch;
294
294
  type RequestInitWithFetch = RequestInit & {
295
295
  fetch?: Fetch;
296
+ /** When true, 401 responses throw without invoking onUnauthorized (e.g. session bootstrap). */
297
+ skipUnauthorizedHandler?: boolean;
296
298
  };
297
299
  type RawHttpResponse = {
298
300
  response: Response;
@@ -1420,7 +1422,10 @@ declare class UserApi {
1420
1422
  private readonly setStoredAuthToken?;
1421
1423
  private readonly clearStoredAuthToken?;
1422
1424
  constructor(transport: HttpTransport, transportBaseUrl: string, setStoredAuthToken?: ((token: string) => void) | undefined, clearStoredAuthToken?: (() => void) | undefined);
1423
- getMe(customFetch?: Fetch): Promise<MeResponse>;
1425
+ getMe(options?: Fetch | {
1426
+ fetch?: Fetch;
1427
+ skipUnauthorizedHandler?: boolean;
1428
+ }): Promise<MeResponse>;
1424
1429
  updateProfile(input: {
1425
1430
  displayName?: string;
1426
1431
  avatarUrl?: string | null;
@@ -2564,8 +2564,9 @@ var UserApi = class {
2564
2564
  this.setStoredAuthToken = setStoredAuthToken;
2565
2565
  this.clearStoredAuthToken = clearStoredAuthToken;
2566
2566
  }
2567
- getMe(customFetch) {
2568
- return this.transport.request("/api/me", { fetch: customFetch });
2567
+ getMe(options) {
2568
+ const init = typeof options === "function" ? { fetch: options } : options;
2569
+ return this.transport.request("/api/me", init);
2569
2570
  }
2570
2571
  updateProfile(input) {
2571
2572
  return this.transport.request("/api/me/profile", {
@@ -102,18 +102,20 @@ var HttpTransport = class {
102
102
  this.onUnauthorized = options.onUnauthorized;
103
103
  }
104
104
  async withAuthorization(init, tokenOverride) {
105
- const headers = new Headers(init?.headers);
105
+ const { fetch: _fetch, skipUnauthorizedHandler: _skip, ...requestInit } = init ?? {};
106
+ const headers = new Headers(requestInit.headers);
106
107
  const token = sanitizeAccessToken(tokenOverride !== void 0 ? tokenOverride : this.getAccessToken ? await this.getAccessToken() : null);
107
108
  if (token) headers.set("Authorization", `Bearer ${token}`);
108
109
  else headers.delete("Authorization");
109
110
  return {
110
- ...init,
111
+ ...requestInit,
111
112
  headers
112
113
  };
113
114
  }
114
115
  async send(path, init) {
115
116
  const fetcher = init?.fetch ?? this.fetcher;
116
117
  const url = joinApiUrl(this.baseUrl, path);
118
+ const skipUnauthorizedHandler = Boolean(init?.skipUnauthorizedHandler);
117
119
  let response;
118
120
  try {
119
121
  response = await fetcher(url, await this.withAuthorization(init));
@@ -148,7 +150,7 @@ var HttpTransport = class {
148
150
  }
149
151
  }
150
152
  if (response.status === 401) {
151
- await this.onUnauthorized?.();
153
+ if (!skipUnauthorizedHandler) await this.onUnauthorized?.();
152
154
  throw new HttpError("unauthorized", 401, null);
153
155
  }
154
156
  if (!response.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub",
3
- "version": "2.11.1",
3
+ "version": "2.11.2",
4
4
  "description": "Cohub SDK for spaces, sessions, checkpoints, and realtime agent collaboration.",
5
5
  "license": "Apache-2.0",
6
6
  "private": false,
@@ -50,7 +50,9 @@
50
50
  "files": [
51
51
  "dist",
52
52
  "README.md",
53
- "docs"
53
+ "docs",
54
+ "LICENSE",
55
+ "NOTICE"
54
56
  ],
55
57
  "devDependencies": {
56
58
  "tsdown": "^0.22.7",