@neta-art/cohub 1.7.0 → 1.7.1

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.
@@ -0,0 +1,10 @@
1
+ import type { Fetch, HttpTransport } from "../transport.js";
2
+ import type { GlobalSearchResponse } from "../types.js";
3
+ export declare class SearchApi {
4
+ private readonly transport;
5
+ constructor(transport: HttpTransport);
6
+ query(input: {
7
+ q: string;
8
+ limit?: number;
9
+ }, customFetch?: Fetch): Promise<GlobalSearchResponse>;
10
+ }
@@ -0,0 +1,14 @@
1
+ export class SearchApi {
2
+ transport;
3
+ constructor(transport) {
4
+ this.transport = transport;
5
+ }
6
+ query(input, customFetch) {
7
+ const params = new URLSearchParams({ q: input.q });
8
+ if (input.limit !== undefined)
9
+ params.set("limit", String(input.limit));
10
+ return this.transport.request(`/api/search?${params.toString()}`, {
11
+ fetch: customFetch,
12
+ });
13
+ }
14
+ }
package/dist/client.d.ts CHANGED
@@ -4,6 +4,7 @@ import { ExploreApi } from "./apis/explore.js";
4
4
  import { ModelsApi } from "./apis/models.js";
5
5
  import { PromptsApi } from "./apis/prompts.js";
6
6
  import { SessionAccessApi } from "./apis/session-access.js";
7
+ import { SearchApi } from "./apis/search.js";
7
8
  import { SpaceClient, SpacesApi, type WebSocketConnectionState } from "./apis/spaces.js";
8
9
  import { TasksApi } from "./apis/tasks.js";
9
10
  import { UserApi } from "./apis/user.js";
@@ -16,6 +17,7 @@ export declare class CohubClient {
16
17
  readonly models: ModelsApi;
17
18
  readonly prompts: PromptsApi;
18
19
  readonly sessionAccess: SessionAccessApi;
20
+ readonly search: SearchApi;
19
21
  readonly tasks: TasksApi;
20
22
  readonly cronJobs: CronJobsApi;
21
23
  readonly explore: ExploreApi;
package/dist/client.js CHANGED
@@ -4,6 +4,7 @@ import { ExploreApi } from "./apis/explore.js";
4
4
  import { ModelsApi } from "./apis/models.js";
5
5
  import { PromptsApi } from "./apis/prompts.js";
6
6
  import { SessionAccessApi } from "./apis/session-access.js";
7
+ import { SearchApi } from "./apis/search.js";
7
8
  import { SpaceClient, SpacesApi } from "./apis/spaces.js";
8
9
  import { TasksApi } from "./apis/tasks.js";
9
10
  import { UserApi } from "./apis/user.js";
@@ -18,6 +19,7 @@ export class CohubClient {
18
19
  models;
19
20
  prompts;
20
21
  sessionAccess;
22
+ search;
21
23
  tasks;
22
24
  cronJobs;
23
25
  explore;
@@ -41,6 +43,7 @@ export class CohubClient {
41
43
  this.models = new ModelsApi(this.transport);
42
44
  this.prompts = new PromptsApi(this.transport);
43
45
  this.sessionAccess = new SessionAccessApi(this.transport);
46
+ this.search = new SearchApi(this.transport);
44
47
  this.tasks = new TasksApi(this.transport);
45
48
  this.cronJobs = new CronJobsApi(this.transport);
46
49
  this.explore = new ExploreApi(this.transport);
@@ -167,11 +167,12 @@ export class SessionGenerationStreamClient {
167
167
  throw new Error("realtime transport is not configured for this client");
168
168
  }
169
169
  ensureRealtimeConnected(this.websocketClient);
170
+ const stream = new SessionGenerationStreamClient(this.websocketClient, this.spaceId, this.sessionId);
170
171
  const unsubscribe = this.websocketClient.on("event", (event) => {
171
172
  if (event.spaceId !== this.spaceId || event.sessionId !== this.sessionId) {
172
173
  return;
173
174
  }
174
- this.handleEvent(event, handlers);
175
+ stream.handleEvent(event, handlers);
175
176
  });
176
177
  return () => unsubscribe();
177
178
  }
package/dist/types.d.ts CHANGED
@@ -279,6 +279,32 @@ export type SpaceChannelBindingInput = {
279
279
  channelId: string;
280
280
  config?: ChannelConfig | null;
281
281
  };
282
+ export type GlobalSearchResult = {
283
+ type: "turn" | "session" | "space";
284
+ id: string;
285
+ spaceId: string;
286
+ sessionId: string | null;
287
+ turnId: string | null;
288
+ sequence: number | null;
289
+ title: string;
290
+ excerpt: string | null;
291
+ spaceName: string | null;
292
+ sessionTitle: string | null;
293
+ matchedField: "userText" | "title" | "name" | "description";
294
+ href: string;
295
+ score: number;
296
+ textScore: number;
297
+ recencyScore: number;
298
+ typePriorityScore: number;
299
+ updatedAt: string | null;
300
+ source: "remote";
301
+ };
302
+ export type GlobalSearchResponse = {
303
+ items: GlobalSearchResult[];
304
+ query: string;
305
+ source: "remote";
306
+ degraded?: boolean;
307
+ };
282
308
  export type SpaceSessionsResponse = {
283
309
  sessions: SessionRecord[];
284
310
  pageInfo?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Cohub SDK for spaces, sessions, checkpoints, and realtime agent collaboration.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,